[SR-Users] add fromuser to sip request
Alex Balashov
abalashov at evaristesys.com
Tue Oct 5 20:18:01 CEST 2010
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 at siprouter, strip 55, append user "sipentry1", dispatch
> t-relay to asterisk
> 562145551212 at siprouter, strip 56, append user "sipentry2", dispatch
> t-relay to asterisk
> 572145551212 at 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)
...
--
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/
More information about the sr-users
mailing list