[Freeswitch-svn] [commit] r1636 - in freeswitch/branches/delbel/trunk: conf src/mod/endpoints/mod_exosip

delbel at freeswitch.org delbel at freeswitch.org
Thu Jun 15 21:29:26 EDT 2006


Author: delbel
Date: Thu Jun 15 21:29:26 2006
New Revision: 1636

Modified:
   freeswitch/branches/delbel/trunk/conf/freeswitch.xml
   freeswitch/branches/delbel/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c

Log:
My first attempt at SIP registration with eXosip, currently broken

Modified: freeswitch/branches/delbel/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/delbel/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/branches/delbel/trunk/conf/freeswitch.xml	Thu Jun 15 21:29:26 2006
@@ -130,6 +130,13 @@
         <!-- <param name="vad" value="out"/> -->
         <!-- <param name="vad" value="both"/> -->
       </settings>
+      <registrations>
+	<param name="fromuser" value="sip:polycom at localhost"/>
+	<param name="proxy" value="sip:localhost:5060"/>
+	<param name="regtimeout" value="3600"/>
+	<param name="username" value="polycom"/>
+	<param name="password" value="test"/>
+      </registrations>
     </configuration>
   
     <configuration name="woomera.conf" description="Woomera Endpoint">

Modified: freeswitch/branches/delbel/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/delbel/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/delbel/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c	Thu Jun 15 21:29:26 2006
@@ -1908,12 +1908,28 @@
 }
 
 
+#if 1
 
+typedef struct regparam_t
+{
+  int regid;
+  int expiry;
+  int auth;
+} regparam_t;
+
+
+#endif
+
 static int config_exosip(int reload)
 {
 	char *cf = "exosip.conf";
 	switch_xml_t cfg, xml, settings, param;
 
+#if 1
+	switch_xml_t registrations;
+	//struct regparam_t regparam = { 0, 3600, 0 };
+#endif
+
 	globals.bytes_per_frame = DEFAULT_BYTES_PER_FRAME;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -1977,6 +1993,37 @@
 			}
 		}
 	}
+#if 1 
+	 else if ((registrations = switch_xml_child(cfg, "registrations"))) {
+		for (param = switch_xml_child(registrations, "param"); param; param = param->next) {
+                        char *fromuser= (char *) switch_xml_attr(param, "fromuser");
+                        char *proxy = (char *) switch_xml_attr(param, "proxy");
+//                        char *contact = (char *) switch_xml_attr(param, "contact");
+                        char *regtimeout_str = (char *) switch_xml_attr(param, "regtimeout");
+                        char *username = (char *) switch_xml_attr(param, "username");
+                        char *password = (char *) switch_xml_attr(param, "password");
+
+			eXosip_lock ();
+
+			int regtimeout = atoi(regtimeout_str);
+
+			if (!username && !password ) 
+				eXosip_add_authentication_info (username, username, password, NULL, NULL);
+
+                        osip_message_t *reg = NULL;
+
+			int id =  eXosip_register_build_initial_register (fromuser, proxy, NULL, regtimeout, &reg);
+
+			int res  = eXosip_register_send_register (id, reg);
+
+			if (res != 0)
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not register!\n");
+
+			eXosip_unlock();
+		}
+
+	}
+#endif
 	
 
 	if (!globals.rtpip) {



More information about the Freeswitch-svn mailing list