Asterisk 13 put in music on hold 'default' when execute Dial

When I send a Dial command to my provider, Asterisk is putting the call in music oh hold when should wait or ring.

This is my dial plan, first line the Dial and second line the Noop with the error treatment with hangup cause (the error happen almost 5 seconds after send the Dial and with the call in music on hold):

 same => n,Dial(PJSIP/${EXTEN}@provider1,90/nj,tT)
 same => n,NoOp(SIP return code : ${HANGUPCAUSE})

Return in the CLI:

    -- Executing [34443914@outbound-routes-novo:5] Dial("PJSIP/19034005-00007452", "PJSIP/34443914@provider1,90/nj,tT") in new stack
    -- Called PJSIP/34443914@provider1
    -- Call on PJSIP/provider1-00007453 placed on hold
    -- Started music on hold, class 'default', on channel 'PJSIP/19034005-00007452'
[Jan 29 21:09:44] WARNING[20082][C-0000313f]: translate.c:407 framein: no samples for ulawtolin
    -- PJSIP/provider1-00007453 is making progress passing it to PJSIP/19034005-00007452
    -- PJSIP/19019001-00007451 answered PJSIP/provider1-0000744f
    -- Stopped music on hold on PJSIP/provider1-0000744f
  == Begin MixMonitor Recording PJSIP/provider1-0000744f
    -- Executing [s@macro-set-variables:1] Set("PJSIP/19019001-00007451", "CDR(when_was_attended)=2021-01-29 21:09:44") in new stack
    -- Channel PJSIP/19019001-00007451 joined 'simple_bridge' basic-bridge <f11055f6-5fd1-4332-b0fe-020d4cf2299f>
    -- Channel PJSIP/provider1-0000744f joined 'simple_bridge' basic-bridge <f11055f6-5fd1-4332-b0fe-020d4cf2299f>
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [34443914@outbound-routes-novo:6] NoOp("PJSIP/19034005-00007452", "SIP return code : 31") in new stack
    -- Executing [34443914@outbound-routes-novo:7] Hangup("PJSIP/19034005-00007452", "") in new stack

Does anyone knows how can I remove the MOH that started incorrectly?

Get the provider to provide early media SDP that doesn’t put the call on hold.

As you didn’t provide the protocol logs, I have to guess that is what they did, although it seems very likely.

Also, as you didn’t provide the full dialplan context, I cannot tell if you have answered the call prematurely, or enabled early media, but that also seems likely, so my first suggestion would be don’t call Answer or Progress, or invoke anything that would implicitly answer the call.

Thanks @david551 bellow I attached more information. One observation, This is not a incoming call, is an outbound call from my Asterisk PBX to my provider.

Whole log in CLI when dial:

    -- Executing [34443914@cliente123:1] Goto("PJSIP/19034005-00008267", "outbound-cid-novo,34443914,1") in new stack
    -- Goto (outbound-cid-novo,34443914,1)
    -- Executing [34443914@outbound-cid-novo:1] ExecIf("PJSIP/19034005-00008267", "0?Set(caller_id=):Set(caller_id=19034005)") in new stack
    -- Executing [34443914@outbound-cid-novo:2] ExecIf("PJSIP/19034005-00008267", "0?Set(caller_id=)") in new stack
    -- Executing [34443914@outbound-cid-novo:3] MYSQL("PJSIP/19034005-00008267", "Connect connid localhost casa casa casa") in new stack
    -- Executing [34443914@outbound-cid-novo:4] Set("PJSIP/19034005-00008267", "errmsg=MySQL connection error") in new stack
    -- Executing [34443914@outbound-cid-novo:5] GotoIf("PJSIP/19034005-00008267", "0?error,MySQL connection error,1") in new stack
    -- Executing [34443914@outbound-cid-novo:6] MYSQL("PJSIP/19034005-00008267", "Query resultid 1 SELECT y.id_cli, y.cod_cli, y.nome, y.alias, z.context, SUBSTRING_INDEX(y.dids_data,'#',1) id_fornecedor, SUBSTRING_INDEX(SUBSTRING_INDEX(y.dids_data,'#',2),'#',-1) fix_lig_ilimitada, SUBSTRING_INDEX(SUBSTRING_INDEX(y.dids_data,'#',3),'#',-1) mov_lig_ilimitada, SUBSTRING_INDEX(y.dids_data,'#',-1) did_number, y.company_name FROM (SELECT nome, alias, id_cli, cod_cli,(select concat(ifnull(d.id_fornecedor,0),'#',ifnull(d.fix_unlimited_calls,0),'#',ifnull(d.mobile_unlimited_calls,0),'#',ifnull(d.did,0)) from dids d where d.id=(select if(us.did_id=0,(select cc.did_id from client cc where cc.id=us.id_cli), us.did_id) did_id from user us where us.cod_cli = 19034005)) dids_data, (select name from client where id=id_cli) company_name FROM user WHERE cod_cli = 19034005) y INNER JOIN (SELECT aors, context FROM ps_endpoints WHERE aors = 19034005) z ON y.cod_cli = z.aors") in new stack
    -- Executing [34443914@outbound-cid-novo:7] MYSQL("PJSIP/19034005-00008267", "Fetch fetchid 2 id_cli ext nome alias context id_fornecedor fix_lig_ilimitada mov_lig_ilimitada did_number company_name") in new stack
    -- Executing [34443914@outbound-cid-novo:8] MYSQL("PJSIP/19034005-00008267", "Clear 2") in new stack
    -- Executing [34443914@outbound-cid-novo:9] MYSQL("PJSIP/19034005-00008267", "Disconnect 1") in new stack
    -- Executing [34443914@outbound-cid-novo:10] Set("PJSIP/19034005-00008267", "errmsg=No results error. No caller ID set") in new stack
    -- Executing [34443914@outbound-cid-novo:11] GotoIf("PJSIP/19034005-00008267", "0?error,No results error. No caller ID set,1") in new stack
    -- Executing [34443914@outbound-cid-novo:12] Set("PJSIP/19034005-00008267", "CALLERID(all)="CLIENTE 123" <551930528009>") in new stack
    -- Executing [34443914@outbound-cid-novo:14] Goto("PJSIP/19034005-00008267", "outbound-routes-novo,34443914,1") in new stack
  == Begin MixMonitor Recording PJSIP/19034005-00008267
    -- Goto (outbound-routes-novo,34443914,1)
    -- Executing [34443914@outbound-routes-novo:1] Set("PJSIP/19034005-00008267", "caller_id=19034005") in new stack
    -- Executing [34443914@outbound-routes-novo:2] Set("PJSIP/19034005-00008267", "CDR(outbound_route)=provider1-fix-paid") in new stack
    -- Executing [34443914@outbound-routes-novo:3] Set("PJSIP/19034005-00008267", "CALLERID(number)=1930528009") in new stack
    -- Executing [34443914@outbound-routes-novo:4] NoOp("PJSIP/19034005-00008267", "CallerID-NUM - 2 = 30528009") in new stack
    -- Executing [34443914@outbound-routes-novo:5] Dial("PJSIP/19034005-00008267", "PJSIP/34443914@provider1,90/nj,tT") in new stack
Called PJSIP/34443914@provider1
    -- Call on PJSIP/provider1-00008291 placed on hold
    **-- Started music on hold, class 'default', on channel 'PJSIP/19034005-00008290'**

Dialplan for this context:

exten => _XXXXXXXX,1,Set(caller_id=${CHANNEL:6:8})
 same => n,Set(CDR(outbound_route)=provider1-fix-paid)
 same => n,Set(CALLERID(number)=${CALLERID(number):2})
 same => n,Noop(CallerID-NUM - 2 = ${CALLERID(number):2})
 same => n,Dial(PJSIP/${EXTEN}@provider1,90/nj,tT)
 same => n,NoOp(SIP return code : ${HANGUPCAUSE})
 same => n,Hangup()

Flow → INVITE request:

The interesting one here would be the session progress, however I note that you are sending the wrong media IP address in your invite.

Here is the SDP Progress:

There is nothing there that should put Asterisk on hold.

It’s too weird, maybe the Dial application could do that when is waiting for answer about the request.

This is second INVITE request in the flow:

You’re showing the SIP messages and SDP between Asterisk and the phone, while you’d need to show it with the provider instead.

This is true.

Here is the SDP Progress for the provider:

The a=sendonly is what is putting it on hold.

how can I remove that? Need to request to the provider?

Yes, I’d inquire with the provider as to why they are doing such a thing and if it can be changed.

What does mean that?
a=sendonly

It literally means they are prepared to send the type of media (audio in this case), but not to receive it. However, it is also the preferred way of indicating “put the call on hold”.

1 Like

Illustrating in a graphical mode

Thanks everyone for these information. I sent a request to my provider check it, to verify if is possible change, then I am waiting for answer.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.