[Freeswitch-dev] sofia_glue - sdp with m=image 0

Wolfgang Pichler wpichler at yosd.at
Fri Mar 22 10:01:37 MSK 2013


sorry - i do have already reconfigured the audiocodes gateway which was
sending this - and it is already in production...

But i think the whole thing is also visible without trace, it is more a
basic implementation question.

The question is - is it really a good idea to overwrite the audio port -
when there is also a image port in the sdp ?

Here is the function i mean:



switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t
*tech_pvt, const char *sdp_str)
{
        const char *err;
        char rip[RA_PTR_LEN] = "";
        char rp[RA_PTR_LEN] = "";
        char rvp[RA_PTR_LEN] = "";
        char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL,
*pe;
        int x;
        const char *val;
        switch_status_t status = SWITCH_STATUS_FALSE;

        if (zstr(sdp_str)) {
                sdp_str = tech_pvt->remote_sdp_str;
        }

        if (zstr(sdp_str)) {
                goto end;
        }

        if ((p = (char *) switch_stristr("c=IN IP4 ", sdp_str)) || (p =
(char *) switch_stristr("c=IN IP6 ", sdp_str))) {
                ip_ptr = p + 9;
        }

        if ((p = (char *) switch_stristr("m=audio ", sdp_str))) {
                port_ptr = p + 8;
        }

        if ((p = (char *) switch_stristr("m=image ", sdp_str))) {
                port_ptr = p + 8;
        }

        if ((p = (char *) switch_stristr("m=video ", sdp_str))) {
                vid_port_ptr = p + 8;
        }


As you can see - it first checks for audio port - writes it to port_ptr,
then checks for the image port - and if it does exists (also if it exists -
but is zero - which is legal) - it does overwrite the audio port.

So calls with sdp

m=audio 12123
and
m=image 0

will get dropped by freeswitch !

Thanks for you attention...

br,
Wolfgang

2013/3/22 Anthony Minessale <anthony.minessale at gmail.com>

> post a trace with "sofia global siptrace on"
> its too hard to diagnose without the exact trace.
>
>
> On Thu, Mar 21, 2013 at 10:03 AM, Wolfgang Pichler <wpichler at yosd.at>wrote:
>
>> Hi all,
>>
>> i have encountered a strange behaviour - and i think i have found a
>> possible problem within sofia_glue
>>
>> Following scenario:
>>
>> Carrier sends INVITE with T38 Offer -> Freeswitch does forward offer ->
>> asterisk does forward offer -> ATA
>>
>> In this scenario it happend to me - that the T38 Offer (with corrent
>> m=image and port in sdp) got forwarded by freeswitch to asterisk, asterisk
>> did forwarded without the T38 Offer (don't know why) - so also without the
>> m=image sdp part - the ATA did answered correctly (without m=image part) ->
>> asterisk did created a new sdp with m=image 0, without T38 parts - and
>> returned this to freeswitch.
>>
>> Freeswitch did hangup the call - because sofia_glue did extracted the
>> port 0 as audio port - and this is not a legal port...
>>
>> Sending port 0 is according to rfc legal - so freeswitch should ignore it
>> in this case.
>>
>> the question is - if both values are given - which one is the value we
>> need ? I think the audio port is the port which is of higher priority.
>>
>> So the workflow should be:
>>  - Try to extract audio port from m=audio part.
>>  - If you got it - and it is a valid port then go on
>>  - else try to extract audio port from m=image part...
>>
>> The function in question is sofia_glue_tech_proxy_remote_addr - in
>> sofia_glue.c
>>
>> Is it generaly a good idea to use the m=image part as audio port ? Why is
>> there no direct image port member in the pvt structure as with the video
>> port ?
>>
>> Hope someone can help here...
>>
>> br,
>> Wolfgang
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wire
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> googletalk:conf+888 at conference.freeswitch.org
> pstn:+19193869900
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20130322/489eb593/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list