[SR-Users] Rewrite From domain

Gonzalo Gasca Meza gascagonzalo at gmail.com
Fri Dec 30 22:28:00 CET 2016


Hi Igor,
Please look for "Masking Twilio call from:"


On Sun, Dec 25, 2016 at 12:47 PM, Igor Olhovskiy <igorolhovskiy at gmail.com>
wrote:

> According to your Pastebin, I couldn’t find in log strings “Masking call
> from”. So, I assume, this code is not executed.
>
> Regards, Igor
>
> On 23 дек. 2016 г., 10:51 +0200, Gonzalo Gasca Meza <
> gascagonzalo at gmail.com>, wrote:
>
> Hi Daniel,
>
> I added xlog and $mb here is the debug:
>
> I still cant figure out how to overwrite the From field.
>
> http://pastebin.com/vMruA0tP
>
> Call flow:
>
> SP1 -> SIP call --> 5061 Kamailio --> DNS resolution -> Remote client, I
> dont see pstn.parzee.io I see sip.sp1.com DOESNT WORK
>
>
> # Manage outgoing branches
>
> branch_route[MANAGE_BRANCH] {
>
>
>         if($fd=~"sip\.xxxxxx\.com") {
>
>            xlog("L_DBG","$mb \n| Masking call from: $fu");
>
>            $fd = "pstn.parzee.io";
>
>            $fu = "sip:" + $fU + "@pstn.parzee.io";
>
>         }
>
>         xdbg("New branch [$T_branch_idx] to: $ru from: $fu $fd\n");
>
>         xlog("L_DBG","$mb \n| New branch \n");
>
>         route(NATMANAGE);
>
> }
>
>
>
>
> On Wed, Dec 21, 2016 at 12:01 AM, Daniel-Constantin Mierla <
> miconda at gmail.com> wrote:
>
>> Hello,
>>
>> for the case when it doesn't work, do you see the xlog message printed?
>>
>> Cheers,
>> Daniel
>>
>> On 21/12/2016 08:37, Gonzalo Gasca Meza wrote:
>>
>> Hi Daniel,
>>
>> Thanks for the advise, I'm using the following configuration,
>>
>> # Manage outgoing branches
>>
>> branch_route[MANAGE_BRANCH] {
>>
>>
>>         if($fd=~"sip\.sp1\.com") {
>>
>>            xlog("L_INFO","|Masking SP1 call from: $fu");
>>
>>            $fd = "pstn.parzee.io";
>>
>>         }
>>
>>         xdbg("new branch [$T_branch_idx] to: $ru from: $fu\n");
>>
>>         route(NATMANAGE);
>>
>> }
>>
>> I have two scenarios which are very similar:
>>
>> 1) PSTN call -> SP1 --> VXML -> Call forward to --> 5061 Kamailio --> DNS
>> resolution -> Remote client, I do see pstn.parzee.io WORKS
>>
>> 2)  SP1 -> SIP call --> 5061 Kamailio --> DNS resolution -> Remote
>> client, I dont see pstn.parzee.io I see sip.sp1.com DOESNT WORK
>>
>> I have attached the traces, destination is the same, all calls are SIP
>> TLS in both call legs, any suggestion tu turn on higher debug level to see
>> SIP messages.
>>
>> Traces:
>>
>> Works: http://pastebin.com/k0jZ3aDE
>>
>> Doesnt work: http://pastebin.com/p19rwcrn
>>
>>
>>
>>
>>
>> On Tue, Dec 13, 2016 at 4:50 AM, Daniel-Constantin Mierla <
>> miconda at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> as alternative to assigning to $fd, you can use uac_replace_from()
>>> exported by uac module.
>>>
>>> The best place to do updates to headers for outgoing traffic is in a
>>> branch_route block.
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 13/12/2016 12:05, Gonzalo Gasca Meza wrote:
>>>
>>> Hi all,
>>>
>>> I'm using Kamailio to forward calls between 2 Service Providers and I
>>> need to rewrite the From header "domain" URI.
>>>
>>> Example:
>>>
>>> From: "+18888888888 <%28888%29%20888-8888>" <
>>> sip:+18888888888 at sip.sp1.com> to
>>>
>>> From: "+18888888888 <%28888%29%20888-8888>" <sip:+18888888888@*sip.sp2.com
>>> <http://sip.sp2.com>*>
>>>
>>> *Call flow:*
>>>
>>> Phone A --- > SP1 ---> sip ----> (kamailio) SP2 --(LOCATION)-> Phone B
>>>
>>> When Phone A calls SP2 PhoneB, it contains original sip domain from sp1.
>>> (sip.sp1.com) hence user in SP2 can see call comes from SP1. I would
>>> like to rewrite the From domain field in this conditions:
>>>
>>> a) Calls comes from "sip.sp1.com" AND
>>>
>>> b) Call is being routed to PhoneB.
>>>
>>> Right now Im using the following code to find user and send call to B.
>>>
>>> #!ifdef WITH_ALIASDB
>>>
>>>         # search in DB-based aliases
>>>
>>>         xlog("L_INFO","alias_db_lookup: Call received. $rU\n");
>>>
>>>         if(alias_db_lookup("dbaliases")) {
>>>
>>>                 route(SIPOUT);
>>>
>>>         }
>>>
>>> #!endif
>>>
>>>
>>> I found this in documentation:
>>>
>>> $fd - From URI domain
>>>
>>> if($hdr(From)=~"sip.sp1\.com") {
>>>  ...}
>>>
>>> But not sure where is the best place to overwrite the From URI domain
>>> header.
>>>
>>> Thanks
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>> --
>>> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>>>
>>> _______________________________________________ SIP Express Router
>>> (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org http://lists.sip-router.org/cg
>>> i-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>>
>>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161230/cfd45409/attachment.html>


More information about the sr-users mailing list