Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to configure Asterisk so that it sends RTP packets with audio from the receiver before the remote party actually picks up?

This seems to be required for a VoIP compliance test my setup needs to pass. They use a simulator to test this, and when I call the other party, they pick up the receiver without sending an OK. I can hear audio from the other side, but they cannot hear me. I've looked into directmediasetup, progressinband, prematuremedia but none of those accomplishes what I need. Is it even doable with Asterisk?

Environment:

Asterisk registers to a SIP trunk, hardware SIP phones are registered to Asterisk. Outbound calls go through the SIP trunk. Asterisk version: 1.8.11.

share|improve this question
    
I'm not 100% sure what you're asking for is kosher according to the SIP specification (it seems broken to start sending data to a recipient before they've acknowledged that they're accepting the connection and ready to receive). I'll admit to havign never read said specifications though so maybe someone more knowledgable can weigh in? –  voretaq7 Apr 20 '12 at 5:18
    
Thanks. I'm not quite sure either, but they have their own spec :) And it seems to require it. (To emulate the PSTN?) –  Nikolay Elenkov Apr 20 '12 at 5:31
1  
At least RFC3960 defines this: 'Early media refers to media (e.g., audio and video) that is exchanged before a particular session is accepted by the called user. (...) It may be unidirectional or bidirectional, and can be generated by the caller, the callee, or both.' –  Nikolay Elenkov Apr 20 '12 at 6:16
1  
This seems to work when the target is Asterisk with something like NoOP(test) Progress() SayAlpha(asdf) Wait(20) ... This give audio in both directions without establishing the call. Still not sure what is needed to get it working when calling an actual remote party. –  Nikolay Elenkov Apr 23 '12 at 8:39

3 Answers 3

up vote 1 down vote accepted
+50

Early media is possible with Asterisk, but only in certain situations, and only with the cooperation/support of all the devices and services involved. Some phones and/or service providers do not support early media. Support for early voice and early DTMF may vary.

You have a SIP phone registered to Asterisk, which places a call to an external number. Asterisk in turn Dials that number over a separate SIP trunk. These are two separate call legs. Asterisk can play early media back to the caller (a custom ringtone or music on hold, for instance) and Asterisk can receive early media from the external party over the SIP trunk. However, a standard Dial() statement will automatically Answer() and bridge the call legs together when remote party answers.

It seems you wish to avoid this usually-desired behavior, and bridge the call legs without Answer()ing them. The Dial() application allows you to defer the usually-automatic Answer() using the 'd' or 'D' options. I'm not aware of any Dial() option that will allow you to bridge the call legs without Answer()ing.

Please see the Asterisk wiki for further discussion and examples of early media with Asterisk.

share|improve this answer
1  
Thanks for your answer. That is pretty much what I've pieced together from mailing list posts and bug reports I found online. What I am trying to do is send early voice while receiving early media from the remote party before they answer. So they are the ones that answer and I can't control that. I will experiment with the 'd|D' options, thanks for the hint. As for the actual SIP phone, it can send early voice, I can record voice using Asterisk without sending an OK. Most examples deal with early media when the target is Asterisk, as does the wiki you linked. –  Nikolay Elenkov Apr 29 '12 at 13:01
    
Accepting this as this the more detailed answer. Will post more questions once I get a chance to try out a few things. –  Nikolay Elenkov May 1 '12 at 1:07

It is not doable with asterisk.

Asterisk does not open the reverse media path prematurely, because doing so causes some devices to stop working. It only does premature media in one direction.

You can probably change this by rewriting code (both endpoints have to support this), but the default source tree does not support this.

share|improve this answer
    
Thanks for you answer. Are sure about this? I've seen a few posts that say that it is possible to both receive audio and send inband DTMF tones to a remote IVR by using early media when connected through Asterisk. I have no easy way to test it currently though. –  Nikolay Elenkov Apr 24 '12 at 13:17
    
This is patently false. It absolutely is doable to have bidirectional early media with Asterisk. –  Joe Sniderman Aug 24 at 3:17
    
Please check date of answer. On that date it was not doable. Now it work on SOME equipment, not on all. –  arheops Aug 24 at 6:36

Why not just take Asterisk out of the media path altogether? *

directmedia=yes
directrtpsetup=yes
prematuremedia=no ;this does the exact opposite of what everyone assumes it does
progressinband=no

Asterisk will send the Invite to the other side with your phone's IP address specified in the SDP. When the other side gives a 183 Session Progress, that will be sent by Asterisk back to your phone, with the other side's IP address in the SDP.

As long as your phone supports it, you'll have bi-directional early media without asterisk even having the opportunity to get in the way and mess it up.

* well, asterisk will still re-invite itself back in at the end of the call momentarily, but otherwise it stays out altogether

share|improve this answer
    
Support required on both UA at both end, not only at phone. Also have non-zero risk of avoid asterisk due to directmedia(remove asterisk server from call at all). Directrtpsetup feature was not availible at time of answer. –  arheops Aug 24 at 6:40
    
True regarding directrtpsetup at time of answer. That said, sure you can still stay in the media path and have two-way early media. It kindof goes without saying that both UAs must support it. In the OP's specific case, it is known that the other UA does, but unkown if the OP's does. –  Joe Sniderman Aug 24 at 6:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.