<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>On 7/20/16 9:58 AM, Faheem Muhammad wrote:<br>
</p>
<blockquote
cite="mid:CA++nn_wP_k_HnZ0+gag6TJ_sgPOZRN1tPZ_PUz+vvBg2HUQARw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div>I'm facing a strange dialplan issue with
a PJSIP_DIAL_CONTACTS. </div>
<div><br>
</div>
<div>When I try to call an offline endpoint
with PJSIP_DIAL_CONTACTS, the dial command breaks and the
call control go to hangup block instead of next priority. The
error in CLI says "<b style="background-color:rgb(255,0,0)">Dial
requires an argument (technology/resource)</b>".</div>
<div>This error seems legit as there are no contacts for an
offline endpoint. The dialplan should jump to the next
priority.</div>
<div><br>
</div>
<div>
<div>exten => 1001,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})</div>
<div>exten => 1001,2,,NoOP(${DIALSTATUS})<br>
</div>
<div>exten => 1001,3,<code class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">Dial(PJSIP/mytrunk/sip:${mob</code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">}</code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(128,128,128)!important;background:none!important">@<a
moz-do-not-send="true" href="http://10.0.0.1">10.0.0.1</a></code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">)</code></div>
<div><br>
</div>
<div>exten => h,1,NoOp()</div>
<div>exten => h,n,NoOP(${DIALSTATUS})</div>
</div>
<div><br>
</div>
<div>-----------------------------------------------------------------------</div>
<div>If i try to dial the same offline endpoint with the below
code snippet, it jumps to next prirorty. </div>
<div>
<div>
<div>exten => 1001,1,Dial(PJSIP/${EXTEN})</div>
<div>exten => 1001,2,,NoOP(${DIALSTATUS})<br>
</div>
<div>
<div>exten => 1001,3,<code class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">Dial(PJSIP/mytrunk/sip:${mob</code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">}</code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(128,128,128)!important;background:none!important">@<a
moz-do-not-send="true" href="http://10.0.0.1">10.0.0.1</a></code><code
class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important">)</code></div>
</div>
<div><code class=""
style="line-height:20px;font-size:14px;white-space:nowrap;font-family:Consolas,"Bitstream
Vera Sans Mono","Courier
New",Courier,monospace!important;border-radius:0px!important;border:0px!important;float:none!important;height:auto!important;margin:0px!important;outline:0px!important;overflow:visible!important;padding:0px!important;vertical-align:baseline!important;width:auto!important;min-height:auto!important;color:rgb(0,0,0)!important;background:none!important"><br>
</code></div>
<div>exten => h,1,NoOp()</div>
<div>exten => h,n,NoOP(${DIALSTATUS})</div>
</div>
</div>
<div><br>
</div>
<div>The endpoint may register from multiple device, so I always
have to dial it all contacts. Did anyone else face such
problem?</div>
<div><br>
</div>
</div>
</blockquote>
My solution to this problem was to use a gotoif and check if
PJSIP_DIAL_CONTACTS has any contacts before trying to dial, if it
does not then I skip the dial and goto the next step. So:<br>
<br>
exten => 1001,1,GotoIf($["${PJSIP_DIAL_CONTACTS(${EXTEN})}" =
""]?nocon)<br>
exten => 1001,n,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})<br>
exten => 1001,n(nocon),SomethingElse<br>
<blockquote
cite="mid:CA++nn_wP_k_HnZ0+gag6TJ_sgPOZRN1tPZ_PUz+vvBg2HUQARw@mail.gmail.com"
type="cite">
<div dir="ltr">-- </div>
</blockquote>
<pre class="moz-signature" cols="72">Telecomunicaciones Abiertas de México S.A. de C.V.
Carlos Chávez
+52 (55)9116-91161</pre>
</body>
</html>