Using FreeSwitch with sip-Proxy
Hi! I am using FreeSwitch as sipPbx and Opensbc as sip proxy in some prototype, I want to register my FreeSwitch with my sip provider (that is gafachi) and request should go viya SipProxy(Opensbc). My freeswitch settings are: <gateways> <gateway name="gatway ip"> /// account username *required* /// <param name="username" value="username"/> /// auth realm: *optional* same as gateway name, if blank /// <!--<param name="realm" value="gafachi"/>--> <param name="realm" value="gafachi"/> /// account password *required* /// <param name="password" value="password"/> /// extension for inbound calls: *optional* same as username, if blank /// <param name="extension" value="username"/> /// proxy host: *optional* same as realm, if blank /// <param name="proxy" value="sip proxy ip"/> /// expire in seconds: *optional* 3600, if blank /// <param name="expire-seconds" value="600"/> </gateway> </gateways> As we know realm is the Ip address that goes with username and make request for example username is guest and realm name is gafachi request will be guest@gafachi and proxy is the ip address of sip proxy. When we set Geteway setting in freeswitch configuration file "freeswitch.xml" We gave realm as gafachi ip address and proxy as opensbc machine address . According to this, register request should to gafachi viya sip-proxy, but when we see this wireshark it add proxy ipaddress in register request instead of realm in sip message. As: To:<sip:a2541shRzJKLjtQA@192.168.96.113> So I debugged the source code of FreeSwitch and changed the code in : mod_sofia.c and in config sofia() and chage as : gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy); To gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm); and its working fine and request go through proxy and secrate code captured by OpenSbc. Buit i think it is wrong to edit source code: when I used Asterisk and give register request in sip.conf (Asterisk conf file) like register=>username@gafachi:password:username@opensbcip and everything seems working fine. Also In this case it sends REGISTER sip:opensbcip (request uri) and username@opensbcip(To uri) so in this case opensbc takes it as it is going to register with opensbc and doesn't forward the request to gafachi. I'll be thankful for any guidance on what's going wrong or should I set something else somewhere. Thanks in Advance! Regards, Yogesh
participants (1)
-
Yogesh Chaturvedi