FreeSWITCH 1.8
上QQ阅读APP看书,第一时间看更新

1000...1019, Phone to Phone Local Call

The next natural step is calling from one of our phones to another. The "extension" dealing with this kind of call between demo users is very complex, because it packs a lot of features.

Open the example demo dialplan main file in /usr/local/freeswitch/conf/dialplan/default.xml with an editor, and search for "Local_Extension".

We'll not follow this extension actions step by step, it's too complex and advanced for this part of the book. But look at the condition. The regex in the "expression" field matches the "destination_number" value for 1000...1019, exactly the same series we know are the demo users. So, if from a phone you call one of the other phones, the incoming call leg (the A leg, the call you are originating from the phone) will reach FreeSWITCH, go to the dialplan, matches this extension, and the machinery inside this extension will check if the callee user phone is registered to FreeSWITCH, if it is registered FreeSWITCH will originate a new call leg (the B leg) from itself to the callee phone.

If the callee answers, FreeSWITCH will join (bridge) the two call legs and starts moving the media streams data packets back and forth between caller and callee. If the callee do not answers, or if its phone is not even registered, FreeSWITCH will connect the incoming call (the A leg) to the callee voicemail (so it will not originate a second leg, the voicemail is a FreeSWITCH module, no external entities are involved).

Now you know the plot, you can test the various scenarios, call the other phone, answer, don't answer, call a wrong number, call a non registered phone, call one of the standard users (1000...1019) for which you have not configured a phone. Have fun, already!