git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2102 689a6050-402a-0410-94f2-e92a70836424
0 | 13 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,112 @@ |
1 |
+ |
|
2 |
+Presence_MWI Module |
|
3 |
+ |
|
4 |
+Juha Heinanen |
|
5 |
+ |
|
6 |
+Edited by |
|
7 |
+ |
|
8 |
+Juha Heinanen |
|
9 |
+ |
|
10 |
+ Copyright � 2007 Juha Heinanen |
|
11 |
+ _________________________________________________________ |
|
12 |
+ |
|
13 |
+ Table of Contents |
|
14 |
+ 1. User's Guide |
|
15 |
+ |
|
16 |
+ 1.1. Overview |
|
17 |
+ 1.2. Dependencies |
|
18 |
+ |
|
19 |
+ 1.2.1. OpenSER Modules |
|
20 |
+ 1.2.2. External Libraries or Applications |
|
21 |
+ |
|
22 |
+ 1.3. Exported Parameters |
|
23 |
+ 1.4. Exported Functions |
|
24 |
+ |
|
25 |
+ 2. Developer's Guide |
|
26 |
+ 3. Frequently Asked Questions |
|
27 |
+ _________________________________________________________ |
|
28 |
+ |
|
29 |
+Chapter 1. User's Guide |
|
30 |
+ |
|
31 |
+1.1. Overview |
|
32 |
+ |
|
33 |
+ The module does specific handling for notify-subscribe |
|
34 |
+ message-summary (message waiting indication) events as |
|
35 |
+ specified in RFC 3842. It is used with the general event |
|
36 |
+ handling module, presence. It constructs and adds |
|
37 |
+ message-summary event to it. |
|
38 |
+ |
|
39 |
+ The module does not currently implement any authorization |
|
40 |
+ rules. It assumes that publish requests are only issued by a |
|
41 |
+ voicemail application and subscribe requests only by the owner |
|
42 |
+ of voicemail box. Authorization can thus be easily done by |
|
43 |
+ OpenSER configuration file before calling handle_publish() and |
|
44 |
+ handle_subscribe() functions. |
|
45 |
+ |
|
46 |
+ The module implements a simple check of content type |
|
47 |
+ application/simple-message-summary: Content must start with |
|
48 |
+ Messages-Waiting status line followed by zero or more lines |
|
49 |
+ that consist of tabs and printable ASCII characters. |
|
50 |
+ _________________________________________________________ |
|
51 |
+ |
|
52 |
+1.2. Dependencies |
|
53 |
+ |
|
54 |
+1.2.1. OpenSER Modules |
|
55 |
+ |
|
56 |
+ The following modules must be loaded before this module: |
|
57 |
+ |
|
58 |
+ * presence. |
|
59 |
+ _________________________________________________________ |
|
60 |
+ |
|
61 |
+1.2.2. External Libraries or Applications |
|
62 |
+ |
|
63 |
+ None. |
|
64 |
+ _________________________________________________________ |
|
65 |
+ |
|
66 |
+1.3. Exported Parameters |
|
67 |
+ |
|
68 |
+ None. |
|
69 |
+ _________________________________________________________ |
|
70 |
+ |
|
71 |
+1.4. Exported Functions |
|
72 |
+ |
|
73 |
+ None to be used in configuration file. |
|
74 |
+ _________________________________________________________ |
|
75 |
+ |
|
76 |
+Chapter 2. Developer's Guide |
|
77 |
+ |
|
78 |
+ The module does not provide any API to use in other OpenSER |
|
79 |
+ modules. |
|
80 |
+ _________________________________________________________ |
|
81 |
+ |
|
82 |
+Chapter 3. Frequently Asked Questions |
|
83 |
+ |
|
84 |
+ 3.1. Where can I find more about OpenSER? |
|
85 |
+ 3.2. Where can I post a question about this module? |
|
86 |
+ 3.3. How can I report a bug? |
|
87 |
+ |
|
88 |
+ 3.1. Where can I find more about OpenSER? |
|
89 |
+ |
|
90 |
+ Take a look at http://openser.org/. |
|
91 |
+ |
|
92 |
+ 3.2. Where can I post a question about this module? |
|
93 |
+ |
|
94 |
+ First at all check if your question was already answered on |
|
95 |
+ one of our mailing lists: |
|
96 |
+ |
|
97 |
+ * User Mailing List - |
|
98 |
+ http://openser.org/cgi-bin/mailman/listinfo/users |
|
99 |
+ * Developer Mailing List - |
|
100 |
+ http://openser.org/cgi-bin/mailman/listinfo/devel |
|
101 |
+ |
|
102 |
+ E-mails regarding any stable OpenSER release should be sent to |
|
103 |
+ <users@openser.org> and e-mails regarding development versions |
|
104 |
+ should be sent to <devel@openser.org>. |
|
105 |
+ |
|
106 |
+ If you want to keep the mail private, send it to |
|
107 |
+ <team@openser.org>. |
|
108 |
+ |
|
109 |
+ 3.3. How can I report a bug? |
|
110 |
+ |
|
111 |
+ Please follow the guidelines provided at: |
|
112 |
+ http://sourceforge.net/tracker/?group_id=139143. |
0 | 113 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,131 @@ |
1 |
+/* |
|
2 |
+ * Add "message-summary" event to presence module |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#include <stdio.h> |
|
28 |
+#include <stdlib.h> |
|
29 |
+#include <string.h> |
|
30 |
+#include "../../parser/parse_content.h" |
|
31 |
+#include "../presence/event_list.h" |
|
32 |
+#include "presence_mwi.h" |
|
33 |
+#include "xcap_auth.h" |
|
34 |
+ |
|
35 |
+/* utility function that skips spaces and tabs */ |
|
36 |
+inline char *eat_sp_tab(char *at, char *over) |
|
37 |
+{ |
|
38 |
+ while((at < over) && ((*at == ' ') || (*at == '\t'))) at++; |
|
39 |
+ return at; |
|
40 |
+} |
|
41 |
+ |
|
42 |
+/* utility function that skips printable ascii chars */ |
|
43 |
+inline char *eat_printable(char *at, char *over) |
|
44 |
+{ |
|
45 |
+ while((at < over) && ((*at = '\t') || ((*at >= 32) && (*at <= 126)))) at++; |
|
46 |
+ return at; |
|
47 |
+} |
|
48 |
+ |
|
49 |
+/* |
|
50 |
+ * event specific publish handling - check if body format is ok |
|
51 |
+ */ |
|
52 |
+int mwi_publ_handl(struct sip_msg* msg) |
|
53 |
+{ |
|
54 |
+ str body; |
|
55 |
+ char *at, *over; |
|
56 |
+ |
|
57 |
+ if (get_content_length(msg) == 0) |
|
58 |
+ return 1; |
|
59 |
+ |
|
60 |
+ body.s = get_body(msg); |
|
61 |
+ if (body.s == NULL) { |
|
62 |
+ LOG(L_ERR,"presence_mwi:mwi_publ_handl: ERROR cannot extract body" |
|
63 |
+ " from msg\n"); |
|
64 |
+ goto err; |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ /* content-length (if present) must be already parsed */ |
|
68 |
+ body.len = get_content_length(msg); |
|
69 |
+ over = body.s + body.len; |
|
70 |
+ |
|
71 |
+ /* check msg-status-line */ |
|
72 |
+ if (body.len <= sizeof("Messages-Waiting")) goto err; |
|
73 |
+ if (strcmp(body.s, "Messages-Waiting") != 0) goto err; |
|
74 |
+ at = body.s + sizeof("Messages-Waiting"); |
|
75 |
+ at = eat_sp_tab(at, over); |
|
76 |
+ if ((at >= over) || (*at != ':')) goto err; |
|
77 |
+ at++; |
|
78 |
+ if ((at >= over) || (*at != ' ') || (*at != '\t')) goto err; |
|
79 |
+ at++; |
|
80 |
+ at = eat_sp_tab(at, over); |
|
81 |
+ if (at + 3 >= over) goto err; |
|
82 |
+ if (strcmp(at, "yes") == 0) at = at + 3; |
|
83 |
+ else |
|
84 |
+ if (strcmp(at, "no") == 0) at = at + 2; |
|
85 |
+ else |
|
86 |
+ goto err; |
|
87 |
+ if ((at + 1 >= over) || (*at != '\r') || (*(at + 1) != '\n')) goto err; |
|
88 |
+ at = at + 2; |
|
89 |
+ |
|
90 |
+ /* check that remaining body consists of lines that only contain |
|
91 |
+ printable ascii chars */ |
|
92 |
+ while (at < over) { |
|
93 |
+ at = eat_printable(at, over); |
|
94 |
+ if ((at + 1 >= over) || (*at != '\r') || (*(at + 1) != '\n')) goto err; |
|
95 |
+ at = at + 2; |
|
96 |
+ } |
|
97 |
+ |
|
98 |
+ return 1; |
|
99 |
+ |
|
100 |
+err: |
|
101 |
+ return -1; |
|
102 |
+ |
|
103 |
+} |
|
104 |
+ |
|
105 |
+int mwi_add_events() |
|
106 |
+{ |
|
107 |
+ ev_t event; |
|
108 |
+ |
|
109 |
+ /* constructing message-summary event */ |
|
110 |
+ memset(&event, 0, sizeof(ev_t)); |
|
111 |
+ event.name.s = "message-summary"; |
|
112 |
+ event.name.len = 15; |
|
113 |
+ |
|
114 |
+ event.content_type.s = "application/simple-message-summary"; |
|
115 |
+ event.content_type.len = 34; |
|
116 |
+ |
|
117 |
+ event.type = PUBL_TYPE; |
|
118 |
+ event.req_auth = 0; |
|
119 |
+ event.apply_auth_nbody = 0; |
|
120 |
+ event.is_watcher_allowed = mwi_watcher_allowed; |
|
121 |
+ event.agg_nbody = 0; |
|
122 |
+ event.evs_publ_handl = mwi_publ_handl; |
|
123 |
+ |
|
124 |
+ if (pres_add_event(&event) < 0) { |
|
125 |
+ LOG(L_ERR, "presence_mwi: ERROR while adding event " |
|
126 |
+ "\"message-summary\"\n"); |
|
127 |
+ return -1; |
|
128 |
+ } |
|
129 |
+ |
|
130 |
+ return 0; |
|
131 |
+} |
0 | 132 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+/* |
|
2 |
+ * presence_mwi module - add_event header file |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#ifndef _MWI_ADD_EV_H_ |
|
28 |
+#define _MWI_ADD_EV_H_ |
|
29 |
+ |
|
30 |
+int mwi_add_events(); |
|
31 |
+ |
|
32 |
+#endif |
0 | 33 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,50 @@ |
1 |
+<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ |
|
2 |
+ |
|
3 |
+ |
|
4 |
+<!ENTITY user SYSTEM "presence_mwi_user.sgml"> |
|
5 |
+<!ENTITY devel SYSTEM "presence_mwi_devel.sgml"> |
|
6 |
+<!ENTITY faq SYSTEM "presence_mwi_faq.sgml"> |
|
7 |
+<!ENTITY sql SYSTEM "presence_mwi.sql"> |
|
8 |
+ |
|
9 |
+<!-- Include general documentation entities --> |
|
10 |
+<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml"> |
|
11 |
+%docentities; |
|
12 |
+ |
|
13 |
+]> |
|
14 |
+ |
|
15 |
+<book> |
|
16 |
+ <bookinfo> |
|
17 |
+ <title>Presence_MWI Module</title> |
|
18 |
+ <productname class="trade">&sername;</productname> |
|
19 |
+ <authorgroup> |
|
20 |
+ <author> |
|
21 |
+ <firstname>Juha</firstname> |
|
22 |
+ <surname>Heinanen</surname> |
|
23 |
+ <email>jh@tutpro.com</email> |
|
24 |
+ </author> |
|
25 |
+ <editor> |
|
26 |
+ <firstname>Juha</firstname> |
|
27 |
+ <surname>Heinanen</surname> |
|
28 |
+ <email>jh@tutpro.com</email> |
|
29 |
+ </editor> |
|
30 |
+ </authorgroup> |
|
31 |
+ <copyright> |
|
32 |
+ <year>2007</year> |
|
33 |
+ <holder>Juha Heinanen</holder> |
|
34 |
+ </copyright> |
|
35 |
+ <revhistory> |
|
36 |
+ <revision> |
|
37 |
+ <revnumber>$Revision: 1 $</revnumber> |
|
38 |
+ <date>$Date: 2007-04-30 14:05:57 +0200 (Mon, 30 Jan 2007) $</date> |
|
39 |
+ </revision> |
|
40 |
+ </revhistory> |
|
41 |
+ </bookinfo> |
|
42 |
+ <toc></toc> |
|
43 |
+ |
|
44 |
+ &user; |
|
45 |
+ &devel; |
|
46 |
+ &faq; |
|
47 |
+ |
|
48 |
+</book> |
|
49 |
+ |
|
50 |
+ |
0 | 51 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,23 @@ |
1 |
+<!-- Module Developer's Guide --> |
|
2 |
+ |
|
3 |
+<chapter> |
|
4 |
+ <chapterinfo> |
|
5 |
+ <revhistory> |
|
6 |
+ <revision> |
|
7 |
+ <revnumber>$Revision: 1168 $</revnumber> |
|
8 |
+ <date>$Date: 2007-04-30 15:21:23 +0300 (Mon, 30 Apr 2007) $</date> |
|
9 |
+ </revision> |
|
10 |
+ </revhistory> |
|
11 |
+ </chapterinfo> |
|
12 |
+ <title>Developer's Guide</title> |
|
13 |
+ <para> |
|
14 |
+ The module does not provide any <acronym>API</acronym> |
|
15 |
+ to use in other &ser; modules. |
|
16 |
+ </para> |
|
17 |
+</chapter> |
|
18 |
+ |
|
19 |
+<!-- Keep this element at the end of the file |
|
20 |
+Local Variables: |
|
21 |
+sgml-parent-document: ("presence_mwi.sgml" "book" "chapter") |
|
22 |
+End: |
|
23 |
+--> |
0 | 24 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,70 @@ |
1 |
+<!-- Module FAQ --> |
|
2 |
+ |
|
3 |
+<chapter> |
|
4 |
+ <chapterinfo> |
|
5 |
+ <revhistory> |
|
6 |
+ <revision> |
|
7 |
+ <revnumber>$Revision: 1 $</revnumber> |
|
8 |
+ <date>$Date: 2007-04-30 15:21:23 +0300 (Mon, 30 Apr 2007) $</date> |
|
9 |
+ </revision> |
|
10 |
+ </revhistory> |
|
11 |
+ </chapterinfo> |
|
12 |
+ <title>Frequently Asked Questions</title> |
|
13 |
+ <qandaset defaultlabel="number"> |
|
14 |
+ <qandaentry> |
|
15 |
+ <question> |
|
16 |
+ <para>Where can I find more about OpenSER?</para> |
|
17 |
+ </question> |
|
18 |
+ <answer> |
|
19 |
+ <para> |
|
20 |
+ Take a look at &serhomelink;. |
|
21 |
+ </para> |
|
22 |
+ </answer> |
|
23 |
+ </qandaentry> |
|
24 |
+ <qandaentry> |
|
25 |
+ <question> |
|
26 |
+ <para>Where can I post a question about this module?</para> |
|
27 |
+ </question> |
|
28 |
+ <answer> |
|
29 |
+ <para> |
|
30 |
+ First at all check if your question was already answered on one of |
|
31 |
+ our mailing lists: |
|
32 |
+ </para> |
|
33 |
+ <itemizedlist> |
|
34 |
+ <listitem> |
|
35 |
+ <para>User Mailing List - &seruserslink;</para> |
|
36 |
+ </listitem> |
|
37 |
+ <listitem> |
|
38 |
+ <para>Developer Mailing List - &serdevlink;</para> |
|
39 |
+ </listitem> |
|
40 |
+ </itemizedlist> |
|
41 |
+ <para> |
|
42 |
+ E-mails regarding any stable &ser; release should be sent to |
|
43 |
+ &serusersmail; and e-mails regarding development versions |
|
44 |
+ should be sent to &serdevmail;. |
|
45 |
+ </para> |
|
46 |
+ <para> |
|
47 |
+ If you want to keep the mail private, send it to |
|
48 |
+ &serhelpmail;. |
|
49 |
+ </para> |
|
50 |
+ </answer> |
|
51 |
+ </qandaentry> |
|
52 |
+ <qandaentry> |
|
53 |
+ <question> |
|
54 |
+ <para>How can I report a bug?</para> |
|
55 |
+ </question> |
|
56 |
+ <answer> |
|
57 |
+ <para> |
|
58 |
+ Please follow the guidelines provided at: |
|
59 |
+ &serbugslink;. |
|
60 |
+ </para> |
|
61 |
+ </answer> |
|
62 |
+ </qandaentry> |
|
63 |
+ </qandaset> |
|
64 |
+</chapter> |
|
65 |
+ |
|
66 |
+<!-- Keep this element at the end of the file |
|
67 |
+Local Variables: |
|
68 |
+sgml-parent-document: ("presence_mwi.sgml" "Book" "chapter") |
|
69 |
+End: |
|
70 |
+--> |
0 | 71 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,87 @@ |
1 |
+<!-- Module User's Guide --> |
|
2 |
+ |
|
3 |
+<chapter> |
|
4 |
+ <chapterinfo> |
|
5 |
+ <revhistory> |
|
6 |
+ <revision> |
|
7 |
+ <revnumber>$Revision: 1 $</revnumber> |
|
8 |
+ <date>$Date: 2007-04-30 11:50:33 +0300 (Mon, 30 Apr 2007) $</date> |
|
9 |
+ </revision> |
|
10 |
+ </revhistory> |
|
11 |
+ </chapterinfo> |
|
12 |
+ |
|
13 |
+ <title>User's Guide</title> |
|
14 |
+ |
|
15 |
+ <section> |
|
16 |
+ <title>Overview</title> |
|
17 |
+ <para> |
|
18 |
+ The module does specific handling for notify-subscribe |
|
19 |
+ message-summary (message waiting indication) events |
|
20 |
+ as specified in RFC 3842. |
|
21 |
+ It is used with the general event handling module, |
|
22 |
+ presence. It constructs and adds message-summary event to |
|
23 |
+ it. |
|
24 |
+ </para> |
|
25 |
+ <para> |
|
26 |
+ The module does not currently implement any authorization |
|
27 |
+ rules. It assumes that publish requests are only issued by |
|
28 |
+ a voicemail application and subscribe requests only by |
|
29 |
+ the owner of voicemail box. Authorization can thus |
|
30 |
+ be easily done by &ser; configuration file before |
|
31 |
+ calling handle_publish() and handle_subscribe() |
|
32 |
+ functions. |
|
33 |
+ </para> |
|
34 |
+ <para> |
|
35 |
+ The module implements a simple check of content type |
|
36 |
+ application/simple-message-summary: Content must start |
|
37 |
+ with Messages-Waiting status line followed by zero or |
|
38 |
+ more lines that consist of tabs and printable ASCII |
|
39 |
+ characters. |
|
40 |
+ </para> |
|
41 |
+ </section> |
|
42 |
+ |
|
43 |
+ <section> |
|
44 |
+ <title>Dependencies</title> |
|
45 |
+ <section> |
|
46 |
+ <title>&ser; Modules</title> |
|
47 |
+ <para> |
|
48 |
+ The following modules must be loaded before this module: |
|
49 |
+ <itemizedlist> |
|
50 |
+ <listitem> |
|
51 |
+ <para> |
|
52 |
+ <emphasis>presence</emphasis>. |
|
53 |
+ </para> |
|
54 |
+ </listitem> |
|
55 |
+ </itemizedlist> |
|
56 |
+ </para> |
|
57 |
+ </section> |
|
58 |
+ |
|
59 |
+ <section> |
|
60 |
+ <title>External Libraries or Applications</title> |
|
61 |
+ <para> |
|
62 |
+ None. |
|
63 |
+ </para> |
|
64 |
+ </section> |
|
65 |
+ </section> |
|
66 |
+ |
|
67 |
+ <section> |
|
68 |
+ <title>Exported Parameters</title> |
|
69 |
+ <para> |
|
70 |
+ None. |
|
71 |
+ </para> |
|
72 |
+ </section> |
|
73 |
+ |
|
74 |
+ <section> |
|
75 |
+ <title>Exported Functions</title> |
|
76 |
+ <para> |
|
77 |
+ None to be used in configuration file. |
|
78 |
+ </para> |
|
79 |
+ </section> |
|
80 |
+ |
|
81 |
+</chapter> |
|
82 |
+ |
|
83 |
+<!-- Keep this element at the end of the file |
|
84 |
+Local Variables: |
|
85 |
+sgml-parent-document: ("presence_mwi.sgml" "Book" "chapter") |
|
86 |
+End: |
|
87 |
+--> |
0 | 88 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,122 @@ |
1 |
+/* |
|
2 |
+ * presence_mwi module - Presence Handling of message-summary events |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#include <stdio.h> |
|
28 |
+#include <stdlib.h> |
|
29 |
+#include <string.h> |
|
30 |
+#include <time.h> |
|
31 |
+ |
|
32 |
+#include "../../sr_module.h" |
|
33 |
+#include "../../dprint.h" |
|
34 |
+#include "../../str.h" |
|
35 |
+#include "../../parser/msg_parser.h" |
|
36 |
+#include "../../mem/mem.h" |
|
37 |
+#include "../presence/bind_presence.h" |
|
38 |
+#include "add_events.h" |
|
39 |
+#include "presence_mwi.h" |
|
40 |
+ |
|
41 |
+MODULE_VERSION |
|
42 |
+ |
|
43 |
+/* module functions */ |
|
44 |
+static int mod_init(void); |
|
45 |
+static int child_init(int); |
|
46 |
+static void destroy(void); |
|
47 |
+ |
|
48 |
+/* module variables */ |
|
49 |
+event_api_t pres; |
|
50 |
+add_event_t pres_add_event; |
|
51 |
+ |
|
52 |
+/* module exported commands */ |
|
53 |
+static cmd_export_t cmds[] = |
|
54 |
+{ |
|
55 |
+ {0, 0, 0, 0, 0} |
|
56 |
+}; |
|
57 |
+ |
|
58 |
+/* module exported paramaters */ |
|
59 |
+static param_export_t params[] = { |
|
60 |
+ {0, 0, 0} |
|
61 |
+}; |
|
62 |
+ |
|
63 |
+/* module exports */ |
|
64 |
+struct module_exports exports= { |
|
65 |
+ "presence_mwi", /* module name */ |
|
66 |
+ DEFAULT_DLFLAGS, /* dlopen flags */ |
|
67 |
+ cmds, /* exported functions */ |
|
68 |
+ params, /* exported parameters */ |
|
69 |
+ 0, /* exported statistics */ |
|
70 |
+ 0, /* exported MI functions */ |
|
71 |
+ 0, /* exported pseudo-variables */ |
|
72 |
+ mod_init, /* module initialization function */ |
|
73 |
+ (response_function) 0, /* response handling function */ |
|
74 |
+ destroy, /* destroy function */ |
|
75 |
+ child_init /* per-child init function */ |
|
76 |
+}; |
|
77 |
+ |
|
78 |
+/* |
|
79 |
+ * init module function |
|
80 |
+ */ |
|
81 |
+static int mod_init(void) |
|
82 |
+{ |
|
83 |
+ DBG("presence_mwi: mod_init...\n"); |
|
84 |
+ |
|
85 |
+ bind_presence_t bind_presence; |
|
86 |
+ |
|
87 |
+ bind_presence= (bind_presence_t)find_export("bind_presence", 1,0); |
|
88 |
+ if (!bind_presence) { |
|
89 |
+ LOG(L_ERR, "presence_mwi:mod_init: Can't bind presence\n"); |
|
90 |
+ return -1; |
|
91 |
+ } |
|
92 |
+ if (bind_presence(&pres) < 0) { |
|
93 |
+ LOG(L_ERR, "presence_mwi:mod_init Can't bind pua\n"); |
|
94 |
+ return -1; |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ pres_add_event = pres.add_event; |
|
98 |
+ if (add_event == NULL) { |
|
99 |
+ LOG(L_ERR, "presence_mwi:mod_init Could not import add_event\n"); |
|
100 |
+ return -1; |
|
101 |
+ } |
|
102 |
+ if(mwi_add_events() < 0) { |
|
103 |
+ LOG(L_ERR, "presence_mwi:mod_init: ERROR while adding mwi events\n"); |
|
104 |
+ return -1; |
|
105 |
+ } |
|
106 |
+ |
|
107 |
+ return 0; |
|
108 |
+} |
|
109 |
+ |
|
110 |
+static int child_init(int rank) |
|
111 |
+{ |
|
112 |
+ DBG("presence_mwi: init_child [%d] pid [%d]\n", rank, getpid()); |
|
113 |
+ |
|
114 |
+ return 0; |
|
115 |
+} |
|
116 |
+ |
|
117 |
+static void destroy(void) |
|
118 |
+{ |
|
119 |
+ DBG("presence_mwi: destroying module ...\n"); |
|
120 |
+ |
|
121 |
+ return; |
|
122 |
+} |
0 | 123 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+/* |
|
2 |
+ * presence_mwi module - presence_mwi header file |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#ifndef _PRES_MWI_H_ |
|
28 |
+#define _PRES_MWI_H_ |
|
29 |
+ |
|
30 |
+extern add_event_t pres_add_event; |
|
31 |
+ |
|
32 |
+#endif |
0 | 33 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+/* |
|
2 |
+ * presence_mwi module - xcap functions |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#include "../../str.h" |
|
28 |
+#include "xcap_auth.h" |
|
29 |
+ |
|
30 |
+int mwi_watcher_allowed(subs_t* subs) |
|
31 |
+{ |
|
32 |
+ |
|
33 |
+ subs->status.s = "active"; |
|
34 |
+ subs->status.len = 6; |
|
35 |
+ return 1; |
|
36 |
+} |
0 | 37 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+/* |
|
2 |
+ * presence_mwi module - xcap_auth header file |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2007 Juha Heinanen |
|
5 |
+ * |
|
6 |
+ * This file is part of openser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * openser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * openser is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
+ * GNU General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU General Public License |
|
19 |
+ * along with this program; if not, write to the Free Software |
|
20 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
+ * |
|
22 |
+ * History: |
|
23 |
+ * -------- |
|
24 |
+ * 2007-05-1 initial version (jih) |
|
25 |
+ */ |
|
26 |
+ |
|
27 |
+#ifndef _MWI_XCAP_AUTH_H_ |
|
28 |
+#define _MWI_XCAP_AUTH_H_ |
|
29 |
+ |
|
30 |
+#include "../presence/subscribe.h" |
|
31 |
+ |
|
32 |
+int mwi_watcher_allowed(subs_t* subs); |
|
33 |
+ |
|
34 |
+#endif |