[OpenSIPS-Users] when engage_media_proxy() doesn't

Jeff Pyle jpyle at fidelityvoice.com
Thu Mar 17 17:17:15 CET 2011



On 3/17/11 4:34 AM, "Dan Pascu" <dan at ag-projects.com> wrote:

>
>On 16 Mar 2011, at 23:14, Jeff Pyle wrote:
>
>> I took a stab at the non-automagic method with
>> use_media_proxy()/end_media_session(). So far I've got just a first
>> attempt using them, but it works well enough to get to get the media
>> stream through the relay.
>> 
>> What would cause engage_media_relay() to silently fail, but
>> use_media_proxy() to work?
>> 
>> I have verified there is a create_dialog() in the script before
>> engage_media_relay() was called.  In fact all other dialog-related
>> activity are okay.
>
>It will not work like that (if the dialog is created before
>engage_media_proxy is called). When you call engage_media_proxy it will
>set the dialog flag (so that the dialog module will trace the call) and
>also sets another flag on the message to indicate that a media relay
>needs to be used. Later when the dialog is created, it will find this
>flag and register the callbacks to process the dialog messages. If you
>created the dialog prior to calling engage_media_proxy, the moment when
>it would have find the flag and registered the callbacks is already past.
>In other words, unless you have an explicit need to crate the dialog
>early, don't. By simply invoking engage_media_proxy, a dialog will be
>created for you (it automatically sets the dialog flag).

Dan, I understand what you're saying.  engage_media_proxy() needs to
create the dialog so it can get its bit in to facilitate the media
relaying.

In my case, on my functional machine, the routing logic is like this:

        if (is_method("INVITE")) {
                send_reply("100", "Trying");

                record_route();
                setflag(21);    # non-missed calls
                setflag(22);    # missed calls

                create_dialog();
                if (isflagset(24)) set_dlg_flag("24");
                if (isflagset(6)) {
                        engage_media_proxy();
                }
                route(1);
        }

As you can see it has a create_dialog() before the engage_media_proxy().
And it seems to work okay.  Any thoughts on why that might be?

Regarding the manual functions, does one need to use end_media_session()
in loose_route to handle a reinvite scenario like T.38?  Or is the old
media session some how automatically torn down in this case?  Does one
need to end_media_session() in onreply_route in the case of CANCEL/BYE?


- Jeff




More information about the Users mailing list