Browse code

XJAB module - the sip address that is used when sending info and error messages can be now set using the 'registrar' parameter -- default is 'jabber_gateway@127.0.0.1' -- the old format 'sip_to_jabber_gateway' may not be accepted by some user agents

Daniel-Constantin Mierla authored on 12/05/2003 15:35:59
Showing 3 changed files
... ...
@@ -121,6 +121,11 @@ Desc:		outbound proxy address
121 121
 			address. If is missing, the message will be delivered to the
122 122
 			hostname of the destination address
123 123
 
124
+Name:		registrar
125
+Type:		string
126
+Default:	"jabber_gateway@127.0.0.1"
127
+Desc:		the address in whose behalf the INFO and ERROR messages are sent.
128
+
124 129
 Name:		workers
125 130
 Type:		integer
126 131
 Default:	2
... ...
@@ -98,6 +98,7 @@ db_con_t** db_con;
98 98
 
99 99
 char *db_url   = "sql://root@127.0.0.1/sip_jab";
100 100
 char *db_table = "jusers";
101
+char *registrar=NULL; //"sip:registrar@iptel.org";
101 102
 
102 103
 int nrw = 2;
103 104
 int max_jobs = 10;
... ...
@@ -155,6 +156,7 @@ static param_export_t params[] = {
155 156
 	{"aliases",    STR_PARAM, &jaliases  },
156 157
 	{"proxy",      STR_PARAM, &proxy     },
157 158
 	{"jdomain",    STR_PARAM, &jdomain   },
159
+	{"registrar",  STR_PARAM, &registrar },
158 160
 	{"jport",      INT_PARAM, &jport     },
159 161
 	{"workers",    INT_PARAM, &nrw       },
160 162
 	{"max_jobs",   INT_PARAM, &max_jobs  },
... ...
@@ -88,8 +88,8 @@ int _xj_pid = 0;
88 88
 int main_loop = 1;
89 89
 
90 90
 /** **/
91
-
92
-static str jab_gw_name = {"sip_to_jabber_gateway", 21};
91
+extern char *registrar;
92
+static str jab_gw_name = {"jabber_gateway@127.0.0.1", 24};
93 93
 
94 94
 /**
95 95
  * address corection
... ...
@@ -287,6 +287,18 @@ int xj_worker_process(xj_wlist jwl, char* jaddress, int jport, int rank,
287 287
 	//signal(SIGQUIT, xj_sig_handler);
288 288
 	signal(SIGSEGV, xj_sig_handler);
289 289
 
290
+	if(registrar)
291
+	{
292
+		jab_gw_name.s = registrar;
293
+		jab_gw_name.len = strlen(registrar);
294
+		if(registrar[0]== 's' && registrar[1]== 'i' &&
295
+			registrar[2]== 'p' && registrar[3]== ':')
296
+		{
297
+			jab_gw_name.s += 4;
298
+			jab_gw_name.len -= 4;
299
+		}
300
+	}
301
+
290 302
 	if(!jwl || !jwl->aliases || !jwl->aliases->jdm 
291 303
 			|| !jaddress || rank >= jwl->len)
292 304
 	{
... ...
@@ -1330,7 +1342,7 @@ void xj_worker_check_jcons(xj_wlist jwl, xj_jcon_pool jcp, int ltime, fd_set *ps
1330 1342
 		{
1331 1343
 #ifdef XJ_EXTRA_DEBUG
1332 1344
 			DBG("XJAB:xj_worker:%d: sending 'terminated' status to SIP"
1333
-					"subscriber\n", _xj_pid);
1345
+					" subscriber\n", _xj_pid);
1334 1346
 #endif
1335 1347
 			xj_pres_list_notifyall(jcp->ojc[i]->plist,
1336 1348
 					XJ_PS_TERMINATED);