Transfer and scoping confusion
Hi Guys, I am climbing the learning curve, but I am at a standstill on this. I have searched both books and online for this, and have experimented with limited success. I have setup the standard FS box, a little behind at v.1.2.5.3 and I have managed to fumble my way though TDM connections, dialplan extensions, and even have HylaFax functioning. I am now "stretching" myself by adding some requested user features. The first is answering a call and sending directly to voicemail instead of the default rerun through the default local extension.
From the 40,000 ft view, the incoming, internal (Local_Extension) call, a-leg, has been answered and bridged to an internal phone, b-leg. After some communication with the caller, the person on the b-leg elects to send the caller directly to voicemail. I have successfully implemented a "bind_meta_app" to "execute_extension" to a new extension I called direct_to_vmail. Here I "read" the four digit phone number entered. At this point all is well, at least according to the logs.
At this point I need to "unbridge" the b-leg and bridge the a-leg to voicemail. Can't find an unbridge, break looks wrong in this... Transfer appears to be what I need, as it says it "transfers the call into the new context" and seems to infer that an "unbridge" will occur. OK so far? Now, if I transfer, it needs to go to a specific extension that understands the request, so transfer direcly out to another extension by extension name. Logs confirm this does happen. Here is my question about variable scoping. When I "read" the four digit phone number entered I first assumed it created a channel variable, and the log seems to indicate this and seems to follow the transfer used in the features.xml in "is_transfer". This example uses the "read" variable to transfer back into the dialplan. I need to transfer into a particular extension and use this channel variable to know the voicemail requested. I test the channel variable prior to the transfer statement and after entry into the called extension. Initial tests show assignment before transfer, no assignment after which tends to indicate to me a scoping problem. I have tried import and export statements with no success. I defined the channel variable back in the Local_Extension extension before the "execute_extension" to see if it was a variable being declared local later in the call stack... No luck as assignment appears to take place, but not later in the call chain. I know this is long and "wordy", I just think this is a problem with understanding the basics of FS and I don't want to get bogged-down with specific XML statements until I know I understand the basics. Any Ideas? What am I missing? Thanks James
Hi James, Just had a quick read over this.. As you mentioned, it's quite long winded so it may be worth writing up a more condensed version.. Personally I had difficulty trying to understand what the requirement was. Perhaps others might jump in on the thread, but in the mean time, maybe throw together a simplified version of the above with a few specific questions, rather than an open ended "am I doing this right?". Maybe break it up into bullet points, along with your end goals etc. Generally speaking, even if a thread deserves lots of info, most people won't give it a lot of attention unless it's an issue that specifically interests them. If you have a more shorter email that requires less focus / context switching to comprehend, you stand a better chance of getting more replies. Btw - it could just be that my mind isn't focusing properly and thus wasn't able to read the email properly - others might jump on this thread and be able to answer immediately. Cal On Mon, Jun 10, 2013 at 4:15 PM, admin <admin@tedssupply.com> wrote:
Hi Guys,
I am climbing the learning curve, but I am at a standstill on this. I have searched both books and online for this, and have experimented with limited success.
I have setup the standard FS box, a little behind at v.1.2.5.3 and I have managed to fumble my way though TDM connections, dialplan extensions, and even have HylaFax functioning. I am now "stretching" myself by adding some requested user features. The first is answering a call and sending directly to voicemail instead of the default rerun through the default local extension.
From the 40,000 ft view, the incoming, internal (Local_Extension) call, a-leg, has been answered and bridged to an internal phone, b-leg. After some communication with the caller, the person on the b-leg elects to send the caller directly to voicemail. I have successfully implemented a "bind_meta_app" to "execute_extension" to a new extension I called direct_to_vmail. Here I "read" the four digit phone number entered. At this point all is well, at least according to the logs.
At this point I need to "unbridge" the b-leg and bridge the a-leg to voicemail. Can't find an unbridge, break looks wrong in this... Transfer appears to be what I need, as it says it "transfers the call into the new context" and seems to infer that an "unbridge" will occur. OK so far?
Now, if I transfer, it needs to go to a specific extension that understands the request, so transfer direcly out to another extension by extension name. Logs confirm this does happen.
Here is my question about variable scoping. When I "read" the four digit phone number entered I first assumed it created a channel variable, and the log seems to indicate this and seems to follow the transfer used in the features.xml in "is_transfer". This example uses the "read" variable to transfer back into the dialplan. I need to transfer into a particular extension and use this channel variable to know the voicemail requested.
I test the channel variable prior to the transfer statement and after entry into the called extension. Initial tests show assignment before transfer, no assignment after which tends to indicate to me a scoping problem.
I have tried import and export statements with no success.
I defined the channel variable back in the Local_Extension extension before the "execute_extension" to see if it was a variable being declared local later in the call stack... No luck as assignment appears to take place, but not later in the call chain.
I know this is long and "wordy", I just think this is a problem with understanding the basics of FS and I don't want to get bogged-down with specific XML statements until I know I understand the basics.
Any Ideas? What am I missing?
Thanks
James
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks Cal, first time on any mailing list and with lack of sleep I got a bit long winded... I am assuming the subject will create the threading... I also snipped all previous for brevity. Let me know if this is not OK. Let's start simply: After two legs have been bridged, do you use "transfer" to unbridge the calls and then send one of them somewhere else (this is the greater portion of my question) ? Thanks, James
On Mon, Jun 10, 2013 at 10:31 AM, admin <admin@tedssupply.com> wrote:
Thanks Cal, first time on any mailing list and with lack of sleep I got a bit long winded...
I am assuming the subject will create the threading...
I also snipped all previous for brevity.
Let me know if this is not OK.
Let's start simply: After two legs have been bridged, do you use "transfer" to unbridge the calls and then send one of them somewhere else (this is the greater portion of my question) ?
You can use FS command line APIs uuid_transfer or uuid_dual_transfer to accomplish this. See the "API Commands" link on the Wiki navigation panel to see all the API commands in alphabetical order. Try those out and let us know if you have any questions. -MC -- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
Thanks for the help Michael, but I am still missing a tiny thing somewhere.. Let me illustrate as briefly as possible by snipping where possible. Local_Extension is as installed except for: <extension name="Local_Extension"> . . <action application="export" data="new_vm_digits=123" <action application="bind_meta_app" data="4 b s execute_extension::direct_to_vmail XML default"/> . </extension> This matches in an added extension call_direct_to_vmail <extension name="call_direct_to_vmail"> <condition field="destination_number" expression="^direct_to_vmail$"> <action application="read" data="4 4 'tone-stream://%(10000,0,350,440)' digits 30000 #" /> <action application="log" data="INFO Value of digits are [${digits}]" /> <action application="log" data="INFO Value of new_vm_digits before assignment [${new_vm_digits}]"/> <action application="set" data="new_vm_digits=${digits}"/> <action application="log" data="INFO Value of new_vm_digits after assignment [${new_vm_digits}]"/> <action application="transfer" data="-bleg vmail_now XML default"/> </condition> </extension> This transfers to vmail_now: <extension name="vmail_now"> <condition field="destination_number" expression="^vmail_now$"> <action application="log" data="INFO Value of new_vm_digits in vmail_now [${new_vm_digits}]"/> <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${new_vm_digits}"/> </condition> </extension> Logged entries show: Local_extension assigns new_vm_digits = 123 In direct_to_vmail the value of new_vm_digits = 123 BEFORE reassignment In direct_to_vmail the value of new_vm_digits = 1005 after "set", just before "transfer" - number I entered In vmail_now the value of new_vm_digits = 123 In vmail_now [WARNING] mod_voicemail.c:3310 Can't find user [123@xxx.xxx.xxx.xxx] - as expected I am missing the scope of new_vm_digits, but where? Aren't variables global without the "%"? Doesn't the "export" in Local_Extension scope into all following legs? Docs say that "execute_extension" is in scope. The -bleg bothers me also... but thats another day!
Michael Collins <msc@freeswitch.org> 6/10/2013 1:42 PM >>>
On Mon, Jun 10, 2013 at 10:31 AM, admin <admin@tedssupply.com> wrote: Thanks Cal, first time on any mailing list and with lack of sleep I got a bit long winded... I am assuming the subject will create the threading... I also snipped all previous for brevity. Let me know if this is not OK. Let's start simply: After two legs have been bridged, do you use "transfer" to unbridge the calls and then send one of them somewhere else (this is the greater portion of my question) ? You can use FS command line APIs uuid_transfer or uuid_dual_transfer to accomplish this. See the "API Commands" link on the Wiki navigation panel to see all the API commands in alphabetical order. Try those out and let us know if you have any questions. -MC -- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
I don't think you need to use loopback anymore but I could be wrong. - BDF On Jun 11, 2013 8:14 AM, "admin" <admin@tedssupply.com> wrote:
Thanks for the help Michael, but I am still missing a tiny thing somewhere..
Let me illustrate as briefly as possible by snipping where possible. Local_Extension is as installed except for:
<extension name="Local_Extension">
.
.
<action application="export" data="new_vm_digits=123"
<action application="bind_meta_app" data="4 b s execute_extension::direct_to_vmail XML default"/>
.
</extension>
This matches in an added extension call_direct_to_vmail
<extension name="call_direct_to_vmail">
<condition field="destination_number" expression="^direct_to_vmail$">
<action application="read" data="4 4 'tone-stream://%(10000,0,350,440)' digits 30000 #" />
<action application="log" data="INFO Value of digits are [${digits}]" />
<action application="log" data="INFO Value of new_vm_digits before assignment [${new_vm_digits}]"/>
<action application="set" data="new_vm_digits=${digits}"/>
<action application="log" data="INFO Value of new_vm_digits after assignment [${new_vm_digits}]"/>
<action application="transfer" data="-bleg vmail_now XML default"/>
</condition>
</extension>
This transfers to vmail_now:
<extension name="vmail_now">
<condition field="destination_number" expression="^vmail_now$">
<action application="log" data="INFO Value of new_vm_digits in vmail_now [${new_vm_digits}]"/>
<action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${new_vm_digits}"/>
</condition>
</extension>
Logged entries show:
Local_extension assigns new_vm_digits = 123
In direct_to_vmail the value of new_vm_digits = 123 BEFORE reassignment
In direct_to_vmail the value of new_vm_digits = 1005 after "set", just before "transfer" - number I entered
In vmail_now the value of new_vm_digits = 123
In vmail_now [WARNING] mod_voicemail.c:3310 Can't find user [123@xxx.xxx.xxx.xxx] - as expected
I am missing the scope of new_vm_digits, but where?
Aren't variables global without the "%"?
Doesn't the "export" in Local_Extension scope into all following legs?
Docs say that "execute_extension" is in scope.
The -bleg bothers me also... but thats another day!
Michael Collins <msc@freeswitch.org> 6/10/2013 1:42 PM >>>
On Mon, Jun 10, 2013 at 10:31 AM, admin <admin@tedssupply.com> wrote:
Thanks Cal, first time on any mailing list and with lack of sleep I got a bit long winded...
I am assuming the subject will create the threading...
I also snipped all previous for brevity.
Let me know if this is not OK.
Let's start simply: After two legs have been bridged, do you use "transfer" to unbridge the calls and then send one of them somewhere else (this is the greater portion of my question) ?
You can use FS command line APIs uuid_transfer or uuid_dual_transfer to accomplish this. See the "API Commands" link on the Wiki navigation panel to see all the API commands in alphabetical order. Try those out and let us know if you have any questions.
-MC
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks guys for the help. This problem forced me to rethink, so I just appended the destination number to the called extension named and used regex to strip out the info I needed. Yes, loopback was not required. The variable problem still bothers me...hmmm... Thanks Again! James
Brian Foster <bdfoster@davri.com> 6/11/2013 8:44 AM >>>
I don't think you need to use loopback anymore but I could be wrong. - BDF On Jun 11, 2013 8:14 AM, "admin" <admin@tedssupply.com> wrote: Snip...
participants (4)
-
admin
-
Brian Foster
-
Cal Leeming [Simplicity Media Ltd]
-
Michael Collins