Explorar o código

ims_isc: replace STR_PARAM with PARAM_STR

Alekzander Spiridonov %!s(int64=11) %!d(string=hai) anos
pai
achega
15cdee0778
Modificáronse 1 ficheiros con 4 adicións e 6 borrados
  1. 4 6
      modules/ims_isc/mod.c

+ 4 - 6
modules/ims_isc/mod.c

@@ -56,8 +56,8 @@ struct tm_binds isc_tmb;
 usrloc_api_t isc_ulb; /*!< Structure containing pointers to usrloc functions*/
 
 /* fixed parameter storage */
-char *isc_my_uri_c = "scscf.ims.smilecoms.com:6060"; /**< Uri of myself to loop the message*/
-str isc_my_uri = {0, 0}; /**< Uri of myself to loop the message in str	*/
+char *isc_my_uri_c; /**< Uri of myself to loop the message*/
+str isc_my_uri = str_init("scscf.ims.smilecoms.com:6060"); /**< Uri of myself to loop the message in str	*/
 str isc_my_uri_sip = {0, 0}; /**< Uri of myself to loop the message in str with leading "sip:" */
 int isc_expires_grace = 120; /**< expires value to add to the expires in the 3rd party register*/
 int isc_fr_timeout = 5000; /**< default ISC response timeout in ms */
@@ -83,7 +83,7 @@ static cmd_export_t cmds[] = {
 };
 
 static param_export_t params[] = {
-    { "my_uri", STR_PARAM, &isc_my_uri_c}, /**< SIP Uri of myself for getting the messages back */
+    { "my_uri", PARAM_STR, &isc_my_uri}, /**< SIP Uri of myself for getting the messages back */
     { "expires_grace", INT_PARAM, &isc_expires_grace}, /**< expires value to add to the expires in the 3rd party register to prevent expiration in AS */
     { "isc_fr_timeout", INT_PARAM, &isc_fr_timeout}, /**< Time in ms that we are waiting for a AS response until we
  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 consider it dead. Has to be lower than SIP transaction timeout
@@ -168,13 +168,11 @@ static int mod_init(void) {
     }
 
     /* Init the isc_my_uri parameter */
-    if (!isc_my_uri_c) {
+    if (!isc_my_uri.s || isc_my_uri.len<=0) {
         LM_CRIT("mandatory parameter \"isc_my_uri\" found empty\n");
         goto error;
     }
 
-    isc_my_uri.s = isc_my_uri_c;
-    isc_my_uri.len = strlen(isc_my_uri_c);
     isc_my_uri_sip.len = 4 + isc_my_uri.len;
     isc_my_uri_sip.s = shm_malloc(isc_my_uri_sip.len + 1);
     memcpy(isc_my_uri_sip.s, "sip:", 4);