Transferring Calls between FreeSWITCH and Session Manager - freeswitch

Transferring Calls between FreeSWITCH and Session Manager
We have a Avaya Session Manager and a FreeSWITCH as a feature Server connected with it.
Call from the Avaya CM World routed to the FreeSWITCH via Avaya Session Manager.
In FreeSWITCH we do some processing (replace the Caller ID) and
send it back to the Session Manager
FreeSWITCH handles the Call the as follows
Call come from SM 1.2.3.4
a dialplan calls a lua script
** dnis may be 19131913
this lua script does the processing (db lookup, and so on ...)
finally it calls session:transfer("tosm" .. dnis, "XML", "AS5850"); to transfer the call
a dialplan matching tosm19131913 does a bridge back to SM 1.2.3.4
<extension name="AVAYA SM">
<condition field="destination_number" expression="^tosm(\d*)$">
<action application="bridge" data="sofia/AS5850/0*$1#1.2.3.4"/>
</condition>
</extension>
This works relatively fine but the problem is that FS still holds the call with two channels as long as the call exists. This consumes two channels on the Session Manager wich is expensive.
It is possible on FreeSWITCH commandline to drop the channels so that the call leaves the FS completely. The command to do this is uuid_simplify.
I've tried to execute that command from lua script with
my_fs_api = freeswitch.API()
my_exec_result = my_fs_api:executeString("sofia status")
my_exec_result = my_fs_api:executeString("uuid_simplify " .. my_ssession_uuid)
freeswitch.consoleLog("notice","\n\n[1c] result " .. my_exec_result .. "\n\n")
but it does not work.
I've tried to remove session:tranfer from session transfer and use deflect on the dialplan. This also dosn't work.
Any ideas?

you're simply using the wrong tool. If you only need to modify the SIP headers, such as caller ID, you can easily go with Kamailio and configure it for stateless processing, so that it doesn't need to know about ongoing sessions.
I could help with some consulting in January (currently fully booked for the rest of the year)

You need to use the command deflect of FreeSWITCH that will execute a SIP REFER to complete transferring the call and the call will leave FreeSWITCH.

Related

if of-hook agents in freeswitch can confirm incoming call from queue?

in default configuration in freeswitch, when a call falls into the queue and is routed to an agent, he immediately answers, I want to change that ...
so is there a way (is this possible) for off-hook agents (always connected agents) to acknowledge the call before bridge (for example by pressing DTMF code) ?
Yes, this is possible. In Freeswitch callcenter module (mod_callcenter.c), you can change it according to your need before bridge to agent. And you can write the code for sending dtmf to off-hook agents. I used to do the changes as per my requirement and I also wrote many custom specific modules.
you can achieve exporting group_confirm variables before executing the callcenter app.
-- first set the variables that you want to export
session:setVariable('group_confirm_file', 'file_string:///var/lib/freeswitch/confirm.wav')
session:setVariable('group_confirm_key', '1')
session:setVariable('confirm', 'true')
-- Exporting varibles, this variables the callcenter app will use and add to agents
session:setVariable('cc_export_vars', 'group_confirm_file,group_confirm_key,confirm')
-- Then now execute the callcenter app
session:execute('callcenter', 'QUEUE-NAME-HERE')
Note: This example I used LUA, but it will be the same on XML

asterisk to adhearsion agi async call transfer confusion

We have a telephony service (build on asterisk and adhearsion) in production and now i need another stage server for development and testing. What i need is one asterisk server and two adhearsion one for live and another for stage. Same asterisk for both stage and live adhearsion is because i have telecom sip trunk connection to asterisk. For that i create two AMI connection from manager.conf and configure adhearsion.rb according to AMI configuration.
But confusion is call transfer from asterisk to adhearsion. if i do as follow where a call will transfer. which AMI connection the call use to connect to asterisk ?
[stage]
exten =>_stage_numbers,1,AGI(agi:async)
[live]
exten => _live_numbers,1,AGI(agi:async)
I know call can be handle from router according to number. but i dont wanna mess same live system code.
if call from live number then asterisk transfer call to live adhearsion and call from stage number call transfer to stage adhearsion. Can we do that from asterisk ?
Why not make a 2nd Asterisk server and trunk it to your existing one? Think of it like you're registering the 2nd Asterisk server as you would a phone/user, except the dialplan to call it is different. This is how we implement our tests for Asterisk. Official docs here. That limits the amount of changes you need to make to the production server, and you still get access to the PSTN.
Another option is to make a completely separate Asterisk/Adhearsion deployment and register an endpoint (like a testing phone) to the test Asterisk server to make/receive calls into the Adhearsion system.

Access the name of agent who received the call in a Queue

Is there any way by which i can receive the information about which agent received the call in queue and what is the duration of call and other information.
I read about the variables that hold this information like cc_agent, cc_queue_answered_epoch etc but how can i access them through freeswitch API in Lua OR it must be evaluated from dialplan only by setting action application to "luarun" with required data.! I am simply forwarding the call to queue
Session:execute("callcenter","Sales")
Basically what i am trying to do is recording all this information in a database after agent hangup the call. Any clue or a direction will be very helpful
Depending on how you have your callcenter app setup, you could parse the CDR data for the following:
cc_agent
That value should be something like:
agent007#pbx.widgetets.local
Given this, you can you simple use regex in your scripting language and you'll be able to quickly see the agent that answered the calls.

Automatic Conference Freeswitch calling to multiple callers depending on caller

I am new to Freeswitch. Is it possible that a specific user calls on a number, which results to a conference call. And system adds multiple people to this conference call automatically. e.g.
User "A" calls at 5656. And whenever user A calls at this no, then the dial plan will begin a conference. And User B,C and D will automatically added to this conference. How will the dial plan look like.
Is it possible to mute all except the caller automatically. Can somebody share Dial plan for both of these things?
Thanks
Check mod_conference conference_set_auto_outcall
http://wiki.freeswitch.org/wiki/Conference_set_auto_outcall
The conference is anyway started by an extension, if you use dial plans. When conference_set_auto_outcall can call some predefined numbers.
you need to issue an originate command after your conference is established. Then it will make outgoing calls and join them into the bridge. See mod_conference documentation on FreeSWITCH wiki.
I think the easiest way to do so is to write a Lua script and execute it from your dialplan.
As far as I know, there's no ready-made piece of configuration, you either need to learn it yourself or pay someone to implement it.

How can I re-use an existing CIFS session or explicitly terminate one programmatically (W2K8 to Netapp)?

I have a program that runs on Windows and scans shares on a Netapp filer over CIFS. When the scanner runs on W2K3 and exits, running "cifs sessions -c " on the Netapp filer shows that the session is gone. When the same scanner runs on W2K8 and exits, the above Netapp command shows the session to be still alive. The scanner application has already exited so there should be no traffic on the session anymore.
What I have done so far:
1) waited for (more than) cifs.idle_timeout number of seconds to see if the session goes away. It does not.
2) analyzed packet-traces for the communication between W2K3->Netapp and W2K8->Netapp. W2K3 trace shows TREE_CONNECT and TREE_DISCONNECT but W2K8 trace shows only the TREE_CONNECT request. I will verify this but I think the TREE_DISCONNECT on W2K3 is followed by a LOGOFF request (which causes the session to end I would believe?).
3) To see how things would look when Netapp is not in the picture -- from the W2K8-client machine, I accessed via windows-explorer \\C$. This causes a TREE_CONNECT request on the wire. Now I closed the explorer window and the W2K3-server machine closed the session even though there was no TREE_DISCONNECT on the wire generated by the W2K8-client.
So seems like Netapp is expecting something that W2K8 is not sending.
Question : Is there a specific API I can use in my scanner application to
i) send an explicit LOGOFF SMB request when I am done scanning?
ii) or, re-use an existing session b/w the W2K8-client and the Netapp filer for a new scan?
ii) anyone face this or similar scenarios?
Thanks in advance.
For the API - look at NetUseEnum and NetUseDel.
The disconnect you see is due to idle session (session with no open handles). I'm not sure if this is done by the server (which would indicate a difference between Netapp and Windows) or by the client (your scanner holds an open handle, maybe the current directory, while Explorer closes the handle when you close the window).
I'm not sure what you are trying to accomplish, but it might be easier using NetApp tools/APIs. For a lot of administration tasks the Data ONTAP PowerShell Toolkit can really simplify things:
PS C:\> Connect-NaController fas2040rre1
PS C:\> Get-NaCifsShare
MountPoint ShareName Description
---------- --------- -----------
/etc ETC$ Remote Administration
/vol/vol0/home HOME Default Share
... snip ...
/vol/cifs/backups backups
And if PowerShell isn't your thing, you can take a look at the Manageability SDK for a Web Services API to C/C++, Java, Perl and .Net. In that case you'd want to look at the cifs-share-list API's (slightly different between 7.x/8.x).

Resources