Voicemail doesn't work with Mediaproxy

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Voicemail doesn't work with Mediaproxy

osiris123d
I have been trying to fix this for the last 4 days.  I have searched the mailing list with the following keywords (mediaproxy rewritehostport one-way audio, etc) and I find some posts that explain that my "200 ok" messages need say that the "connection information" needs to point to my mediaproxy.  I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but I am sure I am placing it and using it in the wrong spot in my script.

So here is the problem


When a user calls someone and they are busy or not there the caller will be directed to voicemail by using the rewritehostport("ip of voicemail") command.  The caller is nated behind a router.  The caller doesn't hear the voicemail voice prompts, but the caller IS able to leave a voicemail and be heard.  So there is one-way audio going on where the caller can't hear, but voicemail can.  When I do a sniff I see that this is because the caller's RTP is going directly to the Voicemail Servers Public IP address and the Voicemails RTP is going to the Mediaproxy.
Here is the code in question
failure_route[1] {
        ##--
        ##-- If cancelled, exit.
        ##--
        if (t_was_cancelled()) {
                exit;
        };
        ##--
        ##-- If busy send to the e-mail server, prefix the "b"
        ##-- character to indicate busy.
        ##--
        if (t_check_status("486")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
                append_branch();
                route(1);
                exit;
        };
        ##--
        ##-- If timeout (408) or unavailable temporarily (480),
        ##-- prefix the uri with the "u"character to indicate
        ##-- unanswered and send to the e-mail
        ##-- sever
        ##--
        if (t_check_status("408") || t_check_status("480")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
                append_branch();
                route(1);
                exit;
        };
}

onreply_route[1] {
        #
        #-- On-replay block routing --
        #
        if ((isbflagset(6) || isbflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) {
                xlog("L_INFO", "----- Inside OnReply Route 1 with bflag being 6 or 7 and a bunch other stuff");
                if (search("^Content-Type:[ ]*application/sdp")) {
                        xlog("L_INFO", "----- Inside OnReply Route 1 with content type equaling sdp");
                        append_hf("P-hint: onreply_route|usemediaproxy \r\n");
                        use_media_proxy();
 
               };
        };

        if (client_nat_test("1")) {
                xlog("L_INFO", "----- Inside OnReply Route 1 and client nat equaled 1");
                append_hf("P-hint: Onreply-route - fixcontact \r\n");
                fix_contact();
        };

        exit;
}


So how do I solve this issue?

Reply | Threaded
Open this post in threaded view
|

Re: Voicemail doesn't work with Mediaproxy

Thomas Gelf
osiris123d wrote:
> I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but I am sure I
> am placing it and using it in the wrong spot in my script.

Don't do that. If you are using fix_nated_sdp together with mediaproxy,
you will for sure mess up something. Calling "use_media_proxy" in your
INVITE route, your reply route and also for your in-dialog ReINVITES
will automagically fix your SDP.

> failure_route[1] {
>   ...
>   append_branch();

What OpenSIPS version are you using? In recent versions append_branch
is not needed here.

Best regards,
Thomas Gelf

--
 mail: [hidden email]
  web: http://thomas.gelf.net/


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Voicemail doesn't work with Mediaproxy

osiris123d
I am running OpenSIPS version 1.5.1
 
I am sure I found the append_branch command from someone's code I found online.
 
I did have voicemail working to where there was two-way audio.  I thought I had solved everything, but then I came back from the weekend holiday, tried to make a call between two natted devices and noticed that I had broken that.  I forget what I did to make voicemail work, but I will try and find out again.  I will do like you say and make sure I am placing "use_media_proxy" in all the proper routes.  I will post once I figure it out.  I hate it when people on this mailing list figure it out and all the post is "Fixed it" without mentioning what they did.

On Thu, Sep 10, 2009 at 5:35 PM, Thomas Gelf <[hidden email]> wrote:
osiris123d wrote:
> I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but I am sure I
> am placing it and using it in the wrong spot in my script.

Don't do that. If you are using fix_nated_sdp together with mediaproxy,
you will for sure mess up something. Calling "use_media_proxy" in your
INVITE route, your reply route and also for your in-dialog ReINVITES
will automagically fix your SDP.

> failure_route[1] {
>   ...
>   append_branch();

What OpenSIPS version are you using? In recent versions append_branch
is not needed here.

Best regards,
Thomas Gelf

--
 mail: [hidden email]
 web: http://thomas.gelf.net/


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



--
--
*--*--*--*--*--*
Duane
*--*--*--*--*--*
--

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Voicemail doesn't work with Mediaproxy

osiris123d
In reply to this post by osiris123d
Fixed the issue.  You were right.  usemediaproxy wasn't getting called because in the onreply route the first IF statement was never true because bflag6 or bflag7 were never being set.  So here is what I did to fix the issue.


failure_route[1] {
        ##--
        ##-- If cancelled, exit.
        ##--
        if (t_was_cancelled()) {
                exit;
        };
        ##--
        ##-- If busy send to the e-mail server, prefix the "b"
        ##-- character to indicate busy.
        ##--
        if (t_check_status("486")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
#               append_branch();   <---------DELETED this
setbflag(6);
                route(1);
                exit;
        };
        ##--
        ##-- If timeout (408) or unavailable temporarily (480),
        ##-- prefix the uri with the "u"character to indicate
        ##-- unanswered and send to the e-mail
        ##-- sever
        ##--
        if (t_check_status("408") || t_check_status("480")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
#                append_branch();   <---------Deleted this
setbflag(6);
                route(1);
                exit;
        };
}



Thanks for the hint.  This made me go back and re-read up on OpenSIPS routing and really understand the routing logic.  Thanks again.






osiris123d wrote
I have been trying to fix this for the last 4 days.  I have searched the mailing list with the following keywords (mediaproxy rewritehostport one-way audio, etc) and I find some posts that explain that my "200 ok" messages need say that the "connection information" needs to point to my mediaproxy.  I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but I am sure I am placing it and using it in the wrong spot in my script.

So here is the problem


When a user calls someone and they are busy or not there the caller will be directed to voicemail by using the rewritehostport("ip of voicemail") command.  The caller is nated behind a router.  The caller doesn't hear the voicemail voice prompts, but the caller IS able to leave a voicemail and be heard.  So there is one-way audio going on where the caller can't hear, but voicemail can.  When I do a sniff I see that this is because the caller's RTP is going directly to the Voicemail Servers Public IP address and the Voicemails RTP is going to the Mediaproxy.
Here is the code in question
failure_route[1] {
        ##--
        ##-- If cancelled, exit.
        ##--
        if (t_was_cancelled()) {
                exit;
        };
        ##--
        ##-- If busy send to the e-mail server, prefix the "b"
        ##-- character to indicate busy.
        ##--
        if (t_check_status("486")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
                append_branch();
                route(1);
                exit;
        };
        ##--
        ##-- If timeout (408) or unavailable temporarily (480),
        ##-- prefix the uri with the "u"character to indicate
        ##-- unanswered and send to the e-mail
        ##-- sever
        ##--
        if (t_check_status("408") || t_check_status("480")) {
                revert_uri();

                append_hf("P-App-Name: voicemail\r\nP-App-Param: Email-Address=blah.blahmail.com;Mode=both;usr=$tU;dom=@$td\r\n");

                rewritehostport("VoicemailIP");
                append_branch();
                route(1);
                exit;
        };
}

onreply_route[1] {
        #
        #-- On-replay block routing --
        #
        if ((isbflagset(6) || isbflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) {
                xlog("L_INFO", "----- Inside OnReply Route 1 with bflag being 6 or 7 and a bunch other stuff");
                if (search("^Content-Type:[ ]*application/sdp")) {
                        xlog("L_INFO", "----- Inside OnReply Route 1 with content type equaling sdp");
                        append_hf("P-hint: onreply_route|usemediaproxy \r\n");
                        use_media_proxy();
 
               };
        };

        if (client_nat_test("1")) {
                xlog("L_INFO", "----- Inside OnReply Route 1 and client nat equaled 1");
                append_hf("P-hint: Onreply-route - fixcontact \r\n");
                fix_contact();
        };

        exit;
}


So how do I solve this issue?
Reply | Threaded
Open this post in threaded view
|

Re: Voicemail doesn't work with Mediaproxy

Bogdan-Andrei Iancu
In reply to this post by osiris123d
Hi Duane,

In opensips 1.5.x, the usage of append_branch is slightly different than
before. Actually its usage from failure_route was aligned  to the usage
from request route.

See: http://www.opensips.org/Resources/DocsMigration14to15
  http://www.opensips.org/Resources/DocsMigration14to15#toc4

Regards,
Bogdan

Duane Larson wrote:

> I am running OpenSIPS version 1.5.1
>  
> I am sure I found the append_branch command from someone's code I
> found online.
>  
> I did have voicemail working to where there was two-way audio.  I
> thought I had solved everything, but then I came back from the weekend
> holiday, tried to make a call between two natted devices and noticed
> that I had broken that.  I forget what I did to make voicemail work,
> but I will try and find out again.  I will do like you say and make
> sure I am placing "use_media_proxy" in all the proper routes.  I will
> post once I figure it out.  I hate it when people on this mailing list
> figure it out and all the post is "Fixed it" without mentioning what
> they did.
>
> On Thu, Sep 10, 2009 at 5:35 PM, Thomas Gelf <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     osiris123d wrote:
>     > I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but
>     I am sure I
>     > am placing it and using it in the wrong spot in my script.
>
>     Don't do that. If you are using fix_nated_sdp together with
>     mediaproxy,
>     you will for sure mess up something. Calling "use_media_proxy" in your
>     INVITE route, your reply route and also for your in-dialog ReINVITES
>     will automagically fix your SDP.
>
>     > failure_route[1] {
>     >   ...
>     >   append_branch();
>
>     What OpenSIPS version are you using? In recent versions append_branch
>     is not needed here.
>
>     Best regards,
>     Thomas Gelf
>
>     --
>      mail: [hidden email] <mailto:[hidden email]>
>      web: http://thomas.gelf.net/
>
>
>     _______________________________________________
>     Users mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> --
> --
> *--*--*--*--*--*
> Duane
> *--*--*--*--*--*
> --
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Voicemail doesn't work with Mediaproxy

osiris123d
Thanks for the extra info.




Bogdan-Andrei Iancu wrote
Hi Duane,

In opensips 1.5.x, the usage of append_branch is slightly different than
before. Actually its usage from failure_route was aligned  to the usage
from request route.

See: http://www.opensips.org/Resources/DocsMigration14to15
  http://www.opensips.org/Resources/DocsMigration14to15#toc4

Regards,
Bogdan

Duane Larson wrote:
> I am running OpenSIPS version 1.5.1
>  
> I am sure I found the append_branch command from someone's code I
> found online.
>  
> I did have voicemail working to where there was two-way audio.  I
> thought I had solved everything, but then I came back from the weekend
> holiday, tried to make a call between two natted devices and noticed
> that I had broken that.  I forget what I did to make voicemail work,
> but I will try and find out again.  I will do like you say and make
> sure I am placing "use_media_proxy" in all the proper routes.  I will
> post once I figure it out.  I hate it when people on this mailing list
> figure it out and all the post is "Fixed it" without mentioning what
> they did.
>
> On Thu, Sep 10, 2009 at 5:35 PM, Thomas Gelf <thomas@gelf.net
> <mailto:thomas@gelf.net>> wrote:
>
>     osiris123d wrote:
>     > I am trying to use fix_nated_sdp("3", "ip of mediaproxy"0), but
>     I am sure I
>     > am placing it and using it in the wrong spot in my script.
>
>     Don't do that. If you are using fix_nated_sdp together with
>     mediaproxy,
>     you will for sure mess up something. Calling "use_media_proxy" in your
>     INVITE route, your reply route and also for your in-dialog ReINVITES
>     will automagically fix your SDP.
>
>     > failure_route[1] {
>     >   ...
>     >   append_branch();
>
>     What OpenSIPS version are you using? In recent versions append_branch
>     is not needed here.
>
>     Best regards,
>     Thomas Gelf
>
>     --
>      mail: thomas@gelf.net <mailto:thomas@gelf.net>
>      web: http://thomas.gelf.net/
>
>
>     _______________________________________________
>     Users mailing list
>     Users@lists.opensips.org <mailto:Users@lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> --
> --
> *--*--*--*--*--*
> Duane
> *--*--*--*--*--*
> --
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users