浏览代码

* Added "outbound_proxy" parameter to pua module. If set, it is used
when sending out PUBLISH requests.


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3929 689a6050-402a-0410-94f2-e92a70836424

Juha Heinanen 17 年之前
父节点
当前提交
64fcb727e2
共有 5 个文件被更改,包括 40 次插入4 次删除
  1. 16 2
      modules_k/pua/README
  2. 19 0
      modules_k/pua/doc/pua_admin.xml
  3. 3 1
      modules_k/pua/pua.c
  4. 1 0
      modules_k/pua/pua.h
  5. 1 1
      modules_k/pua/send_publish.c

+ 16 - 2
modules_k/pua/README

@@ -32,6 +32,7 @@ Anca-Maria Vamanu
               1.3.4. min_expires (int)
               1.3.4. min_expires (int)
               1.3.5. default_expires (int)
               1.3.5. default_expires (int)
               1.3.6. update_period (int)
               1.3.6. update_period (int)
+              1.3.7. outbound_proxy (str)
 
 
         1.4. Exported Functions
         1.4. Exported Functions
 
 
@@ -56,7 +57,8 @@ Anca-Maria Vamanu
    1.4. Set min_expires parameter
    1.4. Set min_expires parameter
    1.5. Set default_expires parameter
    1.5. Set default_expires parameter
    1.6. Set update_period parameter
    1.6. Set update_period parameter
-   1.7. pua_update_contact usage
+   1.7. Set outbound_proxy parameter
+   1.8. pua_update_contact usage
    2.1. pua_api structure
    2.1. pua_api structure
    2.2. pua_is_dialog usage example
    2.2. pua_is_dialog usage example
    2.3. register_puacb usage example
    2.3. register_puacb usage example
@@ -171,6 +173,18 @@ modparam("pua", "default_expires", 3600)
 modparam("pua", "update_period", 100)
 modparam("pua", "update_period", 100)
 ...
 ...
 
 
+1.3.7. outbound_proxy (str)
+
+   SIP URI of outbound proxy to be used when sending PUBLISH
+   requests.
+
+   By default, no outbound proxy has been defined.
+
+   Example 1.7. Set outbound_proxy parameter
+...
+modparam("pua", "outbound_proxy", "sip:outbound.example.com")
+...
+
 1.4. Exported Functions
 1.4. Exported Functions
 
 
 1.4.1.  pua_update_contact()
 1.4.1.  pua_update_contact()
@@ -189,7 +203,7 @@ modparam("pua", "update_period", 100)
      * 1 - if success.
      * 1 - if success.
      * -1 - if error.
      * -1 - if error.
 
 
-   Example 1.7. pua_update_contact usage
+   Example 1.8. pua_update_contact usage
 ...
 ...
 if(method=="NOTIFY")
 if(method=="NOTIFY")
     pua_update_contact();
     pua_update_contact();

+ 19 - 0
modules_k/pua/doc/pua_admin.xml

@@ -173,6 +173,25 @@ modparam("pua", "default_expires", 3600)
 ...
 ...
 modparam("pua", "update_period", 100)
 modparam("pua", "update_period", 100)
 ...
 ...
+</programlisting>
+		</example>
+	</section>
+	<section>
+		<title><varname>outbound_proxy</varname> (str)</title>
+		<para>
+		SIP URI of outbound proxy to be used when sending
+		PUBLISH requests.
+		</para>
+		<para>
+		<emphasis>By default, no outbound proxy has been defined.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>outbound_proxy</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("pua", "outbound_proxy", "sip:outbound.example.com")
+...
 </programlisting>
 </programlisting>
 		</example>
 		</example>
 	</section>
 	</section>

+ 3 - 1
modules_k/pua/pua.c

@@ -64,6 +64,7 @@ int default_expires=3600;
 static str db_url = {0, 0};
 static str db_url = {0, 0};
 static str db_table= str_init("pua");
 static str db_table= str_init("pua");
 int update_period= 100;
 int update_period= 100;
+str outbound_proxy = {0, 0};
 int startup_time = 0;
 int startup_time = 0;
 pua_event_t* pua_evlist= NULL;
 pua_event_t* pua_evlist= NULL;
 
 
@@ -117,6 +118,7 @@ static param_export_t params[]={
 	{"min_expires",		 INT_PARAM, &min_expires		 },
 	{"min_expires",		 INT_PARAM, &min_expires		 },
 	{"default_expires",  INT_PARAM, &default_expires     },
 	{"default_expires",  INT_PARAM, &default_expires     },
 	{"update_period",	 INT_PARAM, &update_period	     },
 	{"update_period",	 INT_PARAM, &update_period	     },
+	{"outbound_proxy",	 STR_PARAM, &outbound_proxy.s	     },
 	{0,							 0,			0            }
 	{0,							 0,			0            }
 };
 };
 
 
@@ -248,7 +250,7 @@ static int mod_init(void)
 		pua_dbf.close(pua_db);
 		pua_dbf.close(pua_db);
 	pua_db = NULL;
 	pua_db = NULL;
 
 
-	
+	outbound_proxy.len = outbound_proxy.s ? strlen(outbound_proxy.s) : 0;
 
 
 	return 0;
 	return 0;
 }
 }

+ 1 - 0
modules_k/pua/pua.h

@@ -41,5 +41,6 @@ extern int HASH_SIZE;
 extern int min_expires;
 extern int min_expires;
 extern int pua_ul_publish;
 extern int pua_ul_publish;
 extern int default_expires;
 extern int default_expires;
+extern str outbound_proxy;
 
 
 #endif
 #endif

+ 1 - 1
modules_k/pua/send_publish.c

@@ -548,7 +548,7 @@ send_publish:
 			publ->pres_uri,					/* From */
 			publ->pres_uri,					/* From */
 			str_hdr,						/* Optional headers */
 			str_hdr,						/* Optional headers */
 			body,							/* Message body */
 			body,							/* Message body */
-			0,								/* Outbound proxy*/
+			&outbound_proxy,						/* Outbound proxy*/
 			publ_cback_func,				/* Callback function */
 			publ_cback_func,				/* Callback function */
 			(void*)cb_param					/* Callback parameter */
 			(void*)cb_param					/* Callback parameter */
 			);
 			);