[asterisk-dev] [Code Review] Adjust formats of chan_local when channel we proxying changes

David Vossel reviewboard at asterisk.org
Mon Oct 3 10:57:25 CDT 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1137/#review4474
-----------------------------------------------------------



/trunk/channels/chan_local.c
<https://reviewboard.asterisk.org/r/1137/#comment8646>

    We check to see if p is NULL or not right below this.  This macro will dereference p which could cause a crash.



/trunk/channels/chan_local.c
<https://reviewboard.asterisk.org/r/1137/#comment8650>

    This locking is going to be tricky.
    
    I think this will work... After you get the bridge channel, detect if a format change is necessary. If so copy the native formats of the bridge to a temporary format_cap structure.
    
    grab a reference to the p->chan channel and unlock p right after you detect a change has occurred.
    
    At this point only the ast channel (p->owner) is locked.  Copy the native formats over to ast and do all the read and write setting.
    
    unlock the ast channel, at this point no locks are held.
    
    lock the reference to p->chan you got earlier.
    
    copy all the native formats stuff to that channel reference.
    
    unlock the p->chan reference.
    unref the p->chan reference.
    
    lock ast
    lock p
    
    the do the local_queue_frame
    
    then unlock p at the end of the else if like you already are doing.


- David


On Sept. 30, 2011, 8:06 a.m., irroot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1137/
> -----------------------------------------------------------
> 
> (Updated Sept. 30, 2011, 8:06 a.m.)
> 
> 
> Review request for Asterisk Developers and David Vossel.
> 
> 
> Summary
> -------
> 
> This is a most annoying pain and tripped me up no end testing the T38 gateway patch for res_fax.
> 
> Scenario :-
> 
> i have a Linksys 2102 on a fax machine that uses G.729 and switches to ALAW on CNG and then negotiates T.38
> this is awesome as i can now Chat/Fax from same terminal using most effective bandwidth [these are to be deployed
> on sugar cane farms surrounding the kruger park here in south africa over wi-fi]
> 
> for testing purposes im using a local channel into T.30 fax app in res_fax.
> 
> Problem :-
> 
> when the device reinvites ALAW then T.38 it leaves the nativeformat on chan_local as G.729 this will not work
> as it is transcoding the FAX from G.729 to SLIN this will not work and took me a while to spot the problem.
> 
> Soloution :-
> 
> Check the format on the proxy and adjust it if it changes this should be what Local does been a proxy of the channel
> it should follow changes ...
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_local.c 338435 
> 
> Diff: https://reviewboard.asterisk.org/r/1137/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> irroot
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111003/10d4b4a5/attachment-0001.htm>


More information about the asterisk-dev mailing list