<div dir="ltr"><div>Hi everyone,</div>
<div>&nbsp;</div>
<div>I am in the process of doing something very straightforward - hooking up a DID from Link2Voip into my FS instance (built from SVN Curent on Debian)</div>
<div>&nbsp;</div>
<div>In an effort to only change as little as possible to get this baby to respond to a phone call, I have simply added my provider into the /conf/sip_profiles/external and also added in the extension file into /conf/dialplan/extensions</div>

<div>&nbsp;</div>
<div>I am able to get the system to Register and I am also able to get an incoming call - however that is where the fun stops.</div>
<div>&nbsp;</div>
<div>I hit F8 on my console and this is what I got:</div>
<div>&nbsp;</div>
<div>2008-09-18 02:11:38 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing 6044880583-&gt;18665780244 in context public 
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions ${unroll_loops}(true) =~ /^true$/</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions ${sip_looped_call}() =~ /^true$/</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^(10[01][0-9])$/</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^(5551212)$/</div>
<div>2008-09-18 02:11:38 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:11:38 [INFO] switch_core_state_machine.c:114 switch_core_standard_on_routing() No Route, Aborting</div>
<div></div></div>
<div>I <em>think</em> I understand what is going on here - but I <strong>disagree</strong> with defaults.</div>
<div>&nbsp;</div>
<div>For most users, I would expect them to do exactly what I just did - try to change as little as possble and only add files as needed. </div>
<div>&nbsp;</div>
<div>So finding that the initial root of the dialplan matching happens within public.xml, I attempted to see if there was a better regex match (better than the 5551212 :) and tried ^\d{10,15}$ - basically any number between 10 and 15 digits, good for most of the planet generically. I got no matches, so I though maybe the syntax was strange and went for something simpler -&nbsp; ^[0-9]{10,15}$ - still no matches. Then I brute forced it - ^(18665780244)$ - got a match! yay! - Fun stops again :(</div>

<div>&nbsp;</div>
<div>Just to be sure my custom extension matcher in the /conf/dialplan/extensions did not interfere with anything, I renamed it to get it from loading.</div>
<div>&nbsp;</div>
<div>here is the other fun stopper:</div>
<div>&nbsp;</div>
<div>My default context starts to be processed and here is the end of it....</div>
<div>&nbsp;</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9997$/ 
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9998$/</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9999$/</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^(pizza|74992)$/</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions ${module_exists(mod_enum)}(true) =~ /true/</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^(.*)$/</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:97 switch_core_standard_on_routing() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> State Change CS_ROUTING -&gt; CS_EXECUTE</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:727 switch_core_session_signal_state_change() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [BREAK]</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:420 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State ROUTING going to sleep</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:365 switch_core_session_run() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Running State Change CS_EXECUTE</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:430 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State EXECUTE</div>
<div>2008-09-18 02:52:29 [DEBUG] mod_sofia.c:156 sofia_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> SOFIA EXECUTE</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:129 switch_core_standard_on_execute() Standard EXECUTE</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute set(use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)})</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String set(use_profile=default)</div>

<div>2008-09-18 02:52:29 [DEBUG] mod_dptools.c:703 set_function() SET [use_profile]=[default]</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute set_user(<a href="mailto:default@$%7Bdomain">default@${domain</a>})</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String set_user(<a href="mailto:default@192.168.1.66">default@192.168.1.66</a>)</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute db(insert/spymap/${caller_id_number}/${uuid})</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String db(insert/spymap/6045151148/81684762-8567-11dd-967a-a76d8ceadf4f)</div>

<div>2008-09-18 02:52:29 [DEBUG] sofia.c:332 sofia_event_callback() nua_r_cancel: unknown event 32: 200 canceling</div>
<div>2008-09-18 02:52:29 [DEBUG] sofia.c:200 sofia_event_callback() event [nua_r_invite] status [500][Server error occurred (1/SL)] session: n/a</div>
<div>2008-09-18 02:52:29 [DEBUG] sofia.c:200 sofia_event_callback() event [nua_i_state] status [487][Request Terminated] session: <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a></div>

<div>2008-09-18 02:52:29 [DEBUG] sofia.c:2183 sofia_handle_sip_i_state() Channel <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> entering state [terminated]</div>
<div>2008-09-18 02:52:29 [NOTICE] sofia.c:2611 sofia_handle_sip_i_state() Hangup <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [CS_EXECUTE] [ORIGINATOR_CANCEL]</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_channel.c:1381 switch_channel_perform_hangup() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [KILL]</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:727 switch_core_session_signal_state_change() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [BREAK]</div>

<div>2008-09-18 02:52:29 [NOTICE] switch_ivr_originate.c:1321 switch_ivr_originate() Hangup <a href="mailto:sofia/internal/18665780244@vgw1.link2voip.com">sofia/internal/18665780244@vgw1.link2voip.com</a> [CS_CONSUME_MEDIA] [ORIGINATOR_CANCEL]</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_channel.c:1381 switch_channel_perform_hangup() Kill <a href="mailto:sofia/internal/18665780244@vgw1.link2voip.com">sofia/internal/18665780244@vgw1.link2voip.com</a> [KILL]</div>
<div>2008-09-18 02:52:29 [DEBUG] switch_core_session.c:727 switch_core_session_signal_state_change() Kill <a href="mailto:sofia/internal/18665780244@vgw1.link2voip.com">sofia/internal/18665780244@vgw1.link2voip.com</a> [BREAK]</div>

<div>2008-09-18 02:52:29 [DEBUG] switch_ivr_originate.c:1444 switch_ivr_originate() Originate Cancelled by originator termination Cause: 487 [ORIGINATOR_CANCEL]</div>
<div>2008-09-18 02:52:29 [INFO] mod_dptools.c:1814 audio_bridge_function() Originate Failed.&nbsp; Cause: ORIGINATOR_CANCEL</div>
<div></div></div>
<div>Notice the ultra generic destination number matcher getting matched? At this point it seems there is some sort of infinite loop that would keep going until I hung up the phone. I hunt down where the matcher is getting matched and find that it is in the same folder as my custom matcher inside 99999_enum.xml</div>

<div>&nbsp;</div>
<div>So at this point, I go ahead and add back in my custom extension file - I get the same result - what the hell? why is my matcher not getting fired? - because its name is &quot;link2voip.xml&quot; which comes AFTER 99999:</div>

<div>&nbsp;</div>
<div>-rw-r--r-- 1 root root 373 2008-09-18 01:27 00_pizza_demo.xml 
<div>-rw-r--r-- 1 root root 266 2008-09-18 01:27 99999_enum.xml</div>
<div>-rw-r--r-- 1 root root 177 2008-09-18 03:01 link2voip.xml</div></div>
<div>&nbsp;</div>
<div>I then rename it so it comes up sooner:</div>
<div>&nbsp;</div>
<div>-rw-r--r-- 1 root root 177 2008-09-18 03:01 00_link2voip.xml 
<div>-rw-r--r-- 1 root root 373 2008-09-18 01:27 00_pizza_demo.xml</div>
<div>-rw-r--r-- 1 root root 266 2008-09-18 01:27 99999_enum.xml</div>
<div>server-06:/usr/local/freeswitch/conf/dialplan/extensions#</div>
<div></div></div>
<div>&nbsp;</div>
<div>Tada! I get my wish and I can now route to where I want to! Now if I can only get the voice mail app to think I am actually saying something - I think I need to route to the echo app to see what I am saying :)</div>

<div>&nbsp;</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9996$/ 
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9997$/</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9998$/</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9999$/</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:115 parse_exten() Regex mismatch</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /18665780244/</div>
<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:97 switch_core_standard_on_routing() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> State Change CS_ROUTING -&gt; CS_EXECUTE</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_session.c:727 switch_core_session_signal_state_change() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [BREAK]</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:420 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State ROUTING going to sleep</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:365 switch_core_session_run() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Running State Change CS_EXECUTE</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:430 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State EXECUTE</div>
<div>2008-09-18 03:08:28 [DEBUG] mod_sofia.c:156 sofia_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> SOFIA EXECUTE</div>
<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:129 switch_core_standard_on_execute() Standard EXECUTE</div>
<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute set(use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)})</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String set(use_profile=default)</div>

<div>2008-09-18 03:08:28 [DEBUG] mod_dptools.c:703 set_function() SET [use_profile]=[default]</div>
<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute set_user(<a href="mailto:default@$%7Bdomain">default@${domain</a>})</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String set_user(<a href="mailto:default@192.168.1.66">default@192.168.1.66</a>)</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute db(insert/spymap/${caller_id_number}/${uuid})</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String db(insert/spymap/6045151148/bd8aaddc-8569-11dd-bca0-bfa449b5017d)</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute db(insert/last_dial/${caller_id_number}/${destination_number})</div>

<div>2008-09-18 03:08:28 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String db(insert/last_dial/6045151148/18665780244)</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute db(insert/last_dial/global/${uuid})</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_session.c:1059 switch_core_session_execute_application() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Expanded String db(insert/last_dial/global/bd8aaddc-8569-11dd-bca0-bfa449b5017d)</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:140 switch_core_standard_on_execute() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Execute transfer(1001 XML default)</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_ivr.c:1092 switch_ivr_session_transfer() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> State Change CS_EXECUTE -&gt; CS_ROUTING</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_session.c:727 switch_core_session_signal_state_change() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [BREAK]</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_session.c:435 switch_core_session_receive_message() Kill <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> [BREAK]</div>
<div>2008-09-18 03:08:29 [NOTICE] switch_ivr.c:1098 switch_ivr_session_transfer() Transfer <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> to XML[1001@default]</div>
<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:430 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State EXECUTE going to sleep</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:365 switch_core_session_run() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> Running State Change CS_ROUTING</div>

<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:420 switch_core_session_run() (<a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a>) State ROUTING</div>
<div>2008-09-18 03:08:29 [DEBUG] mod_sofia.c:119 sofia_on_routing() <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a> SOFIA ROUTING</div>
<div>2008-09-18 03:08:29 [DEBUG] switch_core_state_machine.c:64 switch_core_standard_on_routing() Standard ROUTING <a href="mailto:sofia/external/6045151148@66.51.127.163">sofia/external/6045151148@66.51.127.163</a></div>

<div>2008-09-18 03:08:29 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing 6045151148-&gt;1001 in context default</div>
<div></div></div>
<div>&nbsp;</div>
<div>So as a Recap, here is what I would like to have changed if possible:</div>
<ol>
<li>A better regex for the default DID install</li>
<li>Fix the regex on the enum extension OR remove it OR Better documentation surrounding the name of a file for custom extensions</li>
<li>It would be awesome to see the dialplan hunt debugs indicate the name of the extension of the match it is currently looking at, for example</li>
<ul>
<li>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() test conditions destination_number(18665780244) =~ /^9998$/</li>
<li>would become:</li>
<li>2008-09-18 03:08:28 [DEBUG] mod_dialplan_xml.c:113 parse_exten() <strong>{tone_stream}</strong> test conditions destination_number(18665780244) =~ /^9998$/</li></ul>
<li>
<div>Fix the infinite loop on the enum extension</div></li></ol>
<div>Thanks for listening!</div>
<div>Christian</div>
<div>&nbsp;</div>
<div>P.S. I originally tried this out on Windows and instead of my destination number getting set correctly, the destination number kept coming back as the username I used to log in with. Is this a known issue or shall I debug?</div>

<p>&nbsp;</p></div>