Hi,

Not sure how can I help you if you do not even provide the "$var(reg_exp)" value you get there :(

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 26.06.2015 14:33, nirali soni wrote:
Hello,

I want to change contact header
$var(from_user)= $avp(i:678) + $fU;
$var(body) = $hdr(Contact);
$var(reg_exp) = "/$avp(i:678)/$var(from_user)/g";
                $var(new_body) = $(var(body){re.subst,$var(reg_exp)}) ;
remove_hf("Contact");
append_hf("Contact: $var(new_body)\r\n");

But this is not working.The problen is in $var(reg_exp).Help me how could I solve this.

Thanks and Regards,
    Nirali Soni

On Wed, Jun 24, 2015 at 6:10 PM, Bogdan-Andrei Iancu <[email protected] <mailto:[email protected]>> wrote:

    Of course you can do it. In a similar way as below:
        if ($rd=="abc.com <http://abc.com>") prefix("7777");

    Regards,

    Bogdan-Andrei Iancu
    OpenSIPS Founder and Developer
    http://www.opensips-solutions.com

    On 24.06.2015 08:36, nirali soni wrote:
    Thank you Bogdan.
    But I still have query on how i could map between prefix and
    domain.If domain is acb.com <http://acb.com> then i apply prefix
    7777 to user and if xyz,com then prefix would be 9999.So is there
    any way to store in db and mapping of these both?

    so In asterisk it would like [email protected]
    <mailto:[email protected]> and [email protected]
    <mailto:[email protected]>.

    Thanks and Regards,
        Nirali Soni

    On Tue, Jun 23, 2015 at 10:34 PM, Bogdan-Andrei Iancu
    <[email protected] <mailto:[email protected]>> wrote:

        Hi,

        So what you want to do is basically to convert from
        1234ABC@..... into [email protected] <mailto:[email protected]> ?

        You can do simple scripting like:
            if ($rU=~"^1234") {
                strip(4);
                $rd = "domain1.com <http://domain1.com>";
            }

        or you can use the dialplan module to do in a scalable way,
        via DB.

            dp_translate("1","$rU/$ru")

        and in dialplan use:
            match_regexp : "^1234[0-9]+"
            subst_exp: "^1234([0-9]+)"
            repl_exp: "sip:\[email protected]" <mailto:sip:%[email protected]>

        See more
        http://www.opensips.org/html/docs/modules/1.11.x/dialplan.html#id249304


        Regards,

        Bogdan-Andrei Iancu
        OpenSIPS Founder and Developer
        http://www.opensips-solutions.com

        On 19.06.2015 12:01, nirali soni wrote:
        Hello Bogdan,

        I am having different accounts with unique account code in
        asterisk.In asterisk peer is defined as [account
        code+extension] like 1234 is account code and 101 is
        extension.its like *[1234101].*So we have different account
        code with same extensions. i want to use opensips to map
        account code with domain.like 1234 having domain abc.com
        <http://abc.com> and 3456 having xyz.com.In
        <http://xyz.com.In> opensips subscriber table  I want to
        insert user as 101 with doman abc.com <http://abc.com>. And
        its forwarded to asterisk with 1234101.How could I do this?




        Thanks and Regards,
            Nirali Soni

        On Thu, Jun 4, 2015 at 4:08 PM, Bogdan-Andrei Iancu
        <[email protected] <mailto:[email protected]>> wrote:

            Hi Nirali,

            Use the s.select transformation with the dot as separator:
            http://www.opensips.org/Documentation/Script-Tran-2-1#toc6

            Regards,

            Bogdan-Andrei Iancu
            OpenSIPS Founder and Developer
            http://www.opensips-solutions.com

            On 04.06.2015 08:46, nirali soni wrote:
            Hi,

            My domain is *www.cname.com <http://www.cname.com>*...I
            want only *cname * from that..How can i do this?

            Thanks and Regards,
                Nirali Soni

            On Wed, May 27, 2015 at 10:34 PM, Bogdan-Andrei Iancu
            <[email protected] <mailto:[email protected]>> wrote:

                Hi,

                you should get the body of the header, remove the
                header, do a subst (to change the username) and
                insert the hdr back:

                $var(body) = $hdr(Authorization);
                $var(new_body) = $(var(body){re.subst,reg_exp}) ;
                // see
                http://www.opensips.org/Documentation/Script-Tran-2-1#toc75
                remove_hf("Authorization");
                append_hf("Authorization: $var(new_body)\r\n");

                Regards,

                Bogdan-Andrei Iancu
                OpenSIPS Founder and Developer
                http://www.opensips-solutions.com

                On 27.05.2015 05:42, nirali soni wrote:

                Thank for reply
                But how could I do this with using regexp?


                On Tue, 26 May 2015 21:56 Bogdan-Andrei Iancu
                <[email protected] <mailto:[email protected]>>
                wrote:

                    Hi Nirali,

                    You could try to do it with some regexp and
                    transformations, but your authentication will
                    fail as the "response" will not match the
                    username - the response is computed based in
                    username, password, etc.

                    Regards,

                    Bogdan-Andrei Iancu
                    OpenSIPS Founder and Developer
                    http://www.opensips-solutions.com

                    On 26.05.2015 14:57, nirali soni wrote:
                    Hi,

                    I want to change Digest username in Register
                    request.My use in opensips Subscribe table as
                    1001 and in asterisk  sip.conf its lilke
                    *1001_cname. *when I try to register to
                    asterisk it sends 403 Forbidden. with user
                    name mismatch.

                    REGISTER
                    sip:192.168.50.123:5060;transport=UDP SIP/2.0
                    Via: SIP/2.0/UDP
                    192.168.50.43:5060;branch=z9hG4bKfa0a.ff2f5601.0
                    Via: SIP/2.0/UDP
                    
192.168.50.30:50413;received=192.168.50.30;branch=z9hG4bK-524287-1---8343a748155f5d1c;rport=50413
                    Max-Forwards: 69
                    Contact:
                    
<sip:[email protected]:50413;rinstance=bf3ed7694430b17a;transport=UDP>
                    
<mailto:sip:[email protected]:50413;rinstance=bf3ed7694430b17a;transport=UDP>
                    To: <sip:[email protected]
                    <mailto:sip%[email protected]>>
                    From: <sip:[email protected]
                    <mailto:sip%[email protected]>>;tag=b223565f
                    Call-ID: eODd20Lykxt_5QhbM49_hg..
                    CSeq: 2 REGISTER
                    Expires: 60
                    Allow: INVITE, ACK, CANCEL, BYE, NOTIFY,
                    REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
                    Supported: replaces, norefersub,
                    extended-refer, timer, outbound, path,
                    X-cisco-serviceuri
                    User-Agent: Zoiper r30798
                    *Authorization: Digest
                    
username="1006",realm="asterisk",nonce="50742ec9",uri="sip:192.168.50.123:5060;transport=UDP",response="c0409f4c7a960df17b24994aff6a9fa2",algorithm=MD5*
                    Allow-Events: presence, kpml
                    Content-Length: 0
                    ==========
                    I want Digest username= 1006_cname ..
                    How can I do this?



                    Thanks and Regards,


                    _______________________________________________
                    Users mailing list
                    [email protected]  <mailto:[email protected]>
                    http://lists.opensips.org/cgi-bin/mailman/listinfo/users










_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to