Hi All,
I am using Kamilio 3.0.2 as a load balancer in front of Asterisk servers, using Dispatcher/PDT and such, working fine. I would like to be able to bring sip calls into Asterisk at different entry points in the dialp plan, so I want to setup sip users; [sipentry1] contex=blah, [sipentry2] context=blahblah.
In Kamailio, how would I go about receiving a sip request, append a user "sipentry1" then forward it to Asterisk? I would be using some sort of trunk prefix to identify which sip request to append the user like:
552145551212@siprouter, strip 55, append user "sipentry1", dispatch t-relay to asterisk 562145551212@siprouter, strip 56, append user "sipentry2", dispatch t-relay to asterisk 572145551212@siprouter, strip 57, append user "sipentry3", dispatch t-relay to asterisk
Any point in the right direction will be appriciated. Which module should I be looking into?
Thanks.
JR
JR,
On 10/05/2010 02:00 PM, JR Richardson wrote:
In Kamailio, how would I go about receiving a sip request, append a user "sipentry1" then forward it to Asterisk? I would be using some sort of trunk prefix to identify which sip request to append the user like:
552145551212@siprouter, strip 55, append user "sipentry1", dispatch t-relay to asterisk 562145551212@siprouter, strip 56, append user "sipentry2", dispatch t-relay to asterisk 572145551212@siprouter, strip 57, append user "sipentry3", dispatch t-relay to asterisk
Any point in the right direction will be appriciated. Which module should I be looking into?
In Asterisk, sip.conf peer matching is done by source host and port unless the 'type' is set to 'dynamic'.
That said, if your desire is to change the From header display name or user part of the From URI, you should use the 'uac' module and look into the 'uac_replace_from()' function. It's a little unorthodox by RFC 2543 standards, but because it spoofs the From header statefully and reverts the value on replies before passing back to the near end--such that the initiating endpoint is none the wiser--it works.
Otherwise, if your main desire is to customise entry points into various dial plan contexts for otherwise similar calls, I suggest routing on a different criterion. Custom headers have sort of become a de facto means of out-of-band inter-machine associated signaling additions in SIP where it is possible to add them. Why not use a custom header? In Kamailio, add a header to the initial INVITE request that is something like:
append_hf("X-JR-Dialplan-Target: my_context");
Then, route all calls in Asterisk via one sip.conf peer and into one "master" dial plan context, where you can then make further routing decisions based on the value of the header - sip.conf:
[my_proxy] ... host=xx.xx.xx.xx insecure=port,invite ... context=master_dp_router
And then in extensions.conf:
[master_dp_router]
exten => _.,1,Goto(${SIP_HEADER(X-JR-Dialplan-Target)},${EXTEN},1)
...
[my_context]
exten => 5551212,1,Answer exten => 5551212,n,Playback(hello-world) ...