Hello,
I write a custom cpp module for freeswitch that exposes an API:
SWITCH_ADD_API(commands_api_interface, "my_hangup", "my_hangup",
my_hangup_api , MY_HANGUP_USAGE);
I want to call this api from dialplan (after bridge hangup) for reading the
variable "billmsec".
I put this into my dialplan:
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=my_hangup_api"/>
After hangup freeswitch call correctly my API but I have not figured out
how to get the variable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120605/7cb4a7db/attachment.html
Are you setting session_in_hangup_hook?
http://wiki.freeswitch.org/wiki/Channel_Variables#session_in_hangup_hook
-MC
Post by cristian re
Hello,
SWITCH_ADD_API(commands_api_interface, "my_hangup", "my_hangup",
my_hangup_api , MY_HANGUP_USAGE);
I want to call this api from dialplan (after bridge hangup) for reading
the variable "billmsec".
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=my_hangup_api"/>
After hangup freeswitch call correctly my API but I have not figured out
how to get the variable.
_________________________________________________________________________
consulting at 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
Join Us At ClueCon - Aug 7-9, 2012
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/20120605/5204c1dd/attachment.html
Yes of course,
I put in my dialplan:
<action application="set" data="session_in_hangup_hook=true"/>
But I read somewhere that it's possible to manage session after
"api_hangup_hook" only by Lua, Javascript or Perl scripts.
If my API is exposed in a module can I use it?
I try in my dialplan to call api with uuid parameter:
<action application="set" data="api_hangup_hook=my_hangup_api ${uuid}"/>
and in my c++ module I try to get session using uuid without success:
switch_core_session_t * s = switch_core_session_locate(uuid);
if (s) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SESSION\n");
switch_core_session_rwunlock(s);
}
2012/6/5 Michael Collins <msc at freeswitch.org>
Post by Michael Collins
Are you setting session_in_hangup_hook?
http://wiki.freeswitch.org/wiki/Channel_Variables#session_in_hangup_hook
-MC
Post by cristian re
Hello,
SWITCH_ADD_API(commands_api_interface, "my_hangup", "my_hangup",
my_hangup_api , MY_HANGUP_USAGE);
I want to call this api from dialplan (after bridge hangup) for reading
the variable "billmsec".
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=my_hangup_api"/>
After hangup freeswitch call correctly my API but I have not figured out
how to get the variable.
_________________________________________________________________________
consulting at 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
Join Us At ClueCon - Aug 7-9, 2012
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
_________________________________________________________________________
consulting at 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
Join Us At ClueCon - Aug 7-9, 2012
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/20120607/39fbfb69/attachment-0001.html
I understood I had to use session directly to obtain the channel...
thanks
2012/6/7 cristian re <cristian.re.work at gmail.com>
Post by cristian re
Yes of course,
<action application="set" data="session_in_hangup_hook=true"/>
But I read somewhere that it's possible to manage session after
"api_hangup_hook" only by Lua, Javascript or Perl scripts.
If my API is exposed in a module can I use it?
<action application="set" data="api_hangup_hook=my_hangup_api ${uuid}"/>
switch_core_session_t * s = switch_core_session_locate(uuid);
if (s) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SESSION\n");
switch_core_session_rwunlock(s);
}
2012/6/5 Michael Collins <msc at freeswitch.org>
Post by Michael Collins
Are you setting session_in_hangup_hook?
http://wiki.freeswitch.org/wiki/Channel_Variables#session_in_hangup_hook
-MC
Post by cristian re
Hello,
SWITCH_ADD_API(commands_api_interface, "my_hangup", "my_hangup",
my_hangup_api , MY_HANGUP_USAGE);
I want to call this api from dialplan (after bridge hangup) for reading
the variable "billmsec".
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=my_hangup_api"/>
After hangup freeswitch call correctly my API but I have not figured out
how to get the variable.
_________________________________________________________________________
consulting at 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
Join Us At ClueCon - Aug 7-9, 2012
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
_________________________________________________________________________
consulting at 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
Join Us At ClueCon - Aug 7-9, 2012
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/20120607/928a585c/attachment.html
Session is one of the parameters that get passed to API calls. If the API was invoked by a session, and not out of band, like form the console or event_socket, or any other way to invoke it, the argument will not be null. You can then get variables from the session handle just like you would do anywhere else.
--Dave
_____
From: cristian re [mailto:cristian.re.work at gmail.com]
To: freeswitch-users at lists.freeswitch.org
Sent: Tue, 05 Jun 2012 08:33:59 -0700
Subject: [Freeswitch-users] how to: get session variable after api_hangup_hook
Hello,
I write a custom cpp module for freeswitch that exposes an API:
SWITCH_ADD_API(commands_api_interface, "my_hangup", "my_hangup", my_hangup_api , MY_HANGUP_USAGE);
I want to call this api from dialplan (after bridge hangup) for reading the variable "billmsec".
I put this into my dialplan:
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=my_hangup_api"/>
After hangup freeswitch call correctly my API but I have not figured out how to get the variable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120605/c148a3b2/attachment.html