[Freeswitch-users] Running a script on a completed transfer
Walter Smith
walter at carezone.com
Thu Oct 27 22:02:56 MSD 2016
The dialplan is hit in step 2 (interpreting "1001" and bridging C to D),
not step 3 (bridging A to D). There's no dialing in step 3, so the dialplan
is not involved. The bridge is done directly in sofia.c.
I seem to have it working with execute_on_post_bridge.
A clarification: the recording needs to be attached to the external call
leg (so everything the customer hears from then on is recorded, regardless
of transfers, holds, etc.).
In the dialplan, I'm exporting a "record_calls" variable to the B leg when
one of the recordable extensions is dialed.
I'm attaching a lua script to execute_on_post_bridge in the incoming and
outgoing dialplans for the external SIP profile. The script finds the other
leg of the bridge, looks for the record_calls variable, and starts the
recording if it's true (unless there's already a recording going).
The nice thing about this is no matter how the external leg gets bridged to
a recordable extension, this will trigger. So it should handle our IVR,
direct dial, internal transfers, whatever.
I'll document execute_on_post_bridge as soon as I get Confluence access.
— Walter
On Thu, Oct 27, 2016 at 5:45 AM, Andrew Cassidy <
andrew at cassidywebservices.co.uk> wrote:
> Transfer hits the dialplan as any other call, so in theory it should just
> work calling record-session as normal. Is that not the case?
>
> On 27 October 2016 at 00:42, Walter Smith <walter at carezone.com> wrote:
>
>> No, for regulatory reasons we need to record all calls to and from
>> certain people. If they get an incoming call or make an outgoing one, it's
>> easily done in the dialplan, but transfers seem to be another level of
>> difficulty.
>>
>> I've discovered the execute_on_post_bridge variable and am experimenting
>> with that. (And hope to document it when I'm done.)
>>
>> -- Walter
>>
>>
>>
>>
>> On Wed, Oct 26, 2016 at 4:36 PM, Brian West <brian at freeswitch.org> wrote:
>>
>>> Are you doing this for billing purposes?
>>>
>>> On Wed, Oct 26, 2016 at 6:22 PM, Walter Smith <walter at carezone.com>
>>> wrote:
>>>
>>>> I need to record calls if/when they touch a certain set of extensions.
>>>> I have most of the logic working but am baffled by one thing: how do I
>>>> cause an application (it’s a lua script) to run when a channel is bridged
>>>> as the result of a transfer?
>>>>
>>>> My usual bag of tricks isn't working because the bridge happens
>>>> "magically" in sofia in response to the REFER. For example,
>>>> execute_on_answer doesn’t help because the answer happens during the
>>>> attended transfer -- I need to run AFTER the transfer (that is, when the
>>>> original A leg is bridged to the attended transfer’s B leg).
>>>>
>>>> Example scenario:
>>>>
>>>> 1. External call comes in (channel A = PSTN to switch, channel B =
>>>> switch to phone with extension 1000)
>>>>
>>>> 2. Ext 1000 does an attended transfer to ext 1001 (channel C = 1000 to
>>>> switch, channel D = switch to 1001)
>>>>
>>>> 3. Transfer completes (sofia bridges channel A to channel D)
>>>>
>>>> I want my script to run on either channel A or D after 3 happens.
>>>>
>>>> What’s the best way to do this?
>>>>
>>>> Thanks,
>>>> Walter
>>>>
>>>>
>>>> ____________________________________________________________
>>>> _____________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://confluence.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/free
>>>> switch-users
>>>> http://www.freeswitch.org
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> *Brian West*
>>> brian at freeswitch.org
>>>
>>>
>>> *Twitter: @FreeSWITCH , @briankwest*
>>> http://www.freeswitchbook.com (50% Discount using code FreeSwitch50)
>>> http://www.freeswitchcookbook.com (50% Discount using code FreeSwitch50)
>>> https://www.gofundme.com/freeswitch_ubuntu
>>>
>>> Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
>>> /r/freeswitch <https://www.reddit.com/r/freeswitch>
>>>
>>> *T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378)
>>> *iNUM:*+883 5100 1420 9001 | *ISN:*410*543 | *Skype:*briankwest
>>>
>>> ____________________________________________________________
>>> _____________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>
>
>
> --
> *Andrew Cassidy BSc (Hons) MBCS SSCA*
> Managing Director
>
> 03303 880 960 andrew at cassidyweb.co.uk <andrew at cassidywebservices.co.uk> ww
> w.cassidyweb.co.uk <http://www.cassidywebservices.co.uk>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20161027/0701fc5e/attachment.html
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list