[SR-Users] add fromuser to sip request

JR Richardson jmr.richardson at gmail.com
Tue Oct 5 22:00:13 CEST 2010


>> 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

Hi Alex.  I use a general context in asterisk to route calls already
and wanted to get away from pattern matches.  I'm using asterisk
realtime and want to decrease the load.  I'll play around with the
'uac_replace_from()' and 'append_hf' to see what works best for me.

I really appreciate your quick response, very insightful.

Thanks.

JR
-- 
JR Richardson
Engineering for the Masses



More information about the sr-users mailing list