Asterisk and the media path

Home » Asterisk Users » Asterisk and the media path
Asterisk Users 8 Comments

I am attempting to get an asterisk server to step out of the media
path, but am running into a brick wall. Can someone assist? Here’s my

Ultimate SIP Provider —> LCR Trunk (Asterisk 1.6) —-> PBX (Asterisk 1.8).

I am attempting to get the trunk to step out of the media stream.
There is no NAT involved, all machines have a public IP.

In the trunk’s sip.conf I have:


And on the connection to the pbx I have canreinvite=yes

On the pbx I have the trunk connection set to canreinvite=yes.

In the CLI on the LCR trunk I see:

8 thoughts on - Asterisk and the media path

  • Hi,
    Can you check if there is any transcoding involved with these calls, or
    maybe some NAT handling needs to be done by asterisk so it’s not stepping
    out of the media-path !?


  • In order to be able to know whether any known bugs are interfering with
    what you are trying to do, we need more specific version numbers.

    Please turn off directrtpsetup; it’s experimental and doesn’t always
    work as you’d expect. In theory it is exactly what you want in this
    scenario, though. If you are using Asterisk 1.6.0.x or 1.6.1.x,
    ‘directmedia’ won’t be recognized either.

    Why ‘directmedia’ on one side and ‘canreinvite’ on the other? They are
    synonyms, you should use the same name on both sides.

    This is unnecessary, unless the devices on the other side of the PBX are
    also on public IPs and you want the PBX to drop out of the media path as

    No, native bridging just means that the media stream will be bridged at
    the RTP layer instead of in the Asterisk core. Whether that is done
    using a Packet2Packet bridge in the RTP stack itself, or pushed out to
    the endpoints (directmedia), it’s still a native bridge. However, the
    fact that you are seeing this message means you don’t have any of the
    large number of reasons that would impede native bridging (transcoding,
    recording, etc.).

    It seems like you have the configuration set up (mostly) properly, so in
    order to know what is going on you’re going to have to post a more
    complete log snippet, including ‘sip debug’ output.

  • Sure, but you used the *old* name for the option on the system running a
    *newer* version of Asterisk. That’s why I was confused, I suspected you
    might have thought that ‘directmedia’ and ‘canreinvite’ were somehow
    different. Since both of your systems are 1.6.2.x or later, you can use
    ‘directmedia’ on all of them.

  • So I need directmedia set in sip.conf on the LCR trunk.

    1) Do I need it in the individual trunk settings for each pbx? Or is
    in sip.conf enough?
    2) Do I need anything on the pbx side that we are hoping to transfer media to?
    3) How long into the call before the media is transferred over?


  • You say ‘in sip.conf’ multiple times, but that’s far too vague to mean
    anything. sip.conf is a configuration file used to define SIP peers (and
    users), each with their own settings. There isn’t any place you can set
    ‘directmedia’ on and have it affect all your defined peers. Each peer
    that should have directmedia enabled must have it set.


    It should happen quite quickly after the call is answered.

  • More specific on sip.conf

    In sip.conf I have a trunk specified for the SIP provider, and a trunk
    specified for the PBX itself.

    Do I need to specify directmedia=yes on both sides?

    Thanks for your help. I’ll be testing it in a few minutes.


  • A2billing usually stays in the media path due to the dialstring
    parameters that it uses to cut a call off when the balance would reach
    $0. To get Asterisk to step out of the media path, I had to change
    dialcommand_param_sipiax_friend and dialcommand_param to |60|S(14400)
    which lets all calls go to 14400 seconds. The default uses the L
    parameter. You need to use the S parameter instead. However the S
    parameter doesn’t like very large numbers in Asterisk 1.4 so I’ve just
    hard set mine.