1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-08-13 17:38:59 +00:00
Files
build
clients
cmake_modules
conf
debian
docs
dtd
freeswitch.xcodeproj
fscomm
htdocs
libs
apr
apr-util
broadvoice
curl
esl
freetdm
build
conf
docs
Doxygen.conf
PRI-BRI-Debug.pdf
async.txt
ftdm-open-issues.txt
glare.txt
io_modules.txt
locking.txt
sigstatus.txt
ss7-native-bridge.txt
variables.txt
mod_freetdm
msvc
sample
src
.gitignore
.update
AUTHORS
CMakeLists.txt
ChangeLog
Makefile.am
NEWS
README
TODO
acinclude.m4
bootstrap
configure.ac
configure.gnu
cyginstall.sh
freetdm.2008.sln
freetdm.2010.sln
freetdm.pc.in
mkrelease.sh
iksemel
ilbc
js
ldns
libcodec2
libdingaling
libedit
libg722_1
libks
libnatpmp
libscgi
libsndfile
libteletone
libtpl-1.5
libwebsockets
libzrtp
miniupnpc
openzap
pcre
portaudio
silk
sofia-sip
spandsp
speex
sqlite
srtp
stfu
tiff-4.0.2
unimrcp
win32
xmlrpc-c
yaml
.gitignore
patches
scripts
src
support-d
w32
web
.gitattributes
.gitignore
CMakeLists.txt
Freeswitch.2005.unsupported.sln
Freeswitch.2008.express.sln
Freeswitch.2008.sln
Freeswitch.2008.sln.debug.bat
Freeswitch.2008.sln.release.bat
Freeswitch.2010.express.sln
Freeswitch.2010.sln
Freeswitch.2012.sln
INSTALL
Makefile.am
acinclude.m4
bootstrap.sh
cc.sh
cluecon.tmpl
cluecon2.tmpl
cluecon2_small.tmpl
cluecon_small.tmpl
configure.in
devel-bootstrap.sh
erlang.spec
freeswitch-sounds-en-us-callie.spec
freeswitch-sounds-music.spec
freeswitch-sounds-ru-RU-elena.spec
freeswitch.spec
swig_common.i
freeswitch/libs/freetdm/docs/variables.txt

123 lines
3.6 KiB
Plaintext
Raw Normal View History

Using FreeTDM Variables
1. User application sending variables or raw buffer to FreeTDM
==============================================================
The User can include a ftdm_usrmsg_t before sending an event to freetdm.
example #1a - Making an outbound call:
--------------------------------------
To make an outbound call:
ftdm_usrmsg_t usrmsg;
memset(&usrmsg, 0, sizeof(usrmsg));
/* Attach variable to usrmsg */
ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available");
ftdm_channel_call_place_ex(ftdmchan, &usrmsg);
example #1b - Adding a variable:
--------------------------------
When using ftmod_sangoma_isdn, user want to specify progress indicator inside PROCEED message.
ftdm_usrmsg_t usrmsg;
memset(&usrmsg, 0, sizeof(usrmsg));
/* Attach variable to usrmsg */
ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available");
/* Request FreeTDM to send a PROCEED msg */
ftdm_channel_call_indicate_ex(ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED, &usrmsg);
example #2 - Setting raw data:
--------------------------------------------------------
When using ftmod_sangoma_isdn, user wants to transmit a custom Facility IE, inside a FACILITY message.
ftdm_usrmsg_t usrmsg;
uint8_t *my_facility_ie = ftdm_calloc(1, 200); /*memory has to be allocated using ftdm_calloc !! */
unsigned my_facility_ie_len = 0;
memset(&usrmsg, 0, sizeof(usrmsg));
/* Fill my_facility_ie with custom data here */
my_facility_ie[my_facility_ie_len++] = 0x1C; /* Q.931 Facility IE ID */
my_facility_ie[my_facility_ie_len++] = 0x03; /* Length of facility IE */
my_facility_ie[my_facility_ie_len++] = 0x01;
my_facility_ie[my_facility_ie_len++] = 0x02;
my_facility_ie[my_facility_ie_len++] = 0x03;
ftdm_usrmsg_set_raw_data(&usrmsg, my_facility_ie, my_facility_ie_len);
ftdm_channel_call_indicate_ex(ftdmchan, FTDM_CHANNEL_INDICATE_FACILITY, &usrmsg);
/* FreeTDM will automatically free my_facility_ie */
2. User application receiving variables and raw buffer from FreeTDM
==================================================================
example #1 - print all variables received from FreeTDM
------------------------------------------------------
/* Inside event call-back function */
ftdm_iterator_t *iter = NULL;
ftdm_iterator_t *curr = NULL;
const char *var_name = NULL;
const char *var_value = NULL;
/* Read all variables attached to this event */
iter = ftdm_sigmsg_get_var_iterator(sigmsg, iter);
for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) {
ftdm_get_current_var(curr, &var_name, &var_value);
fprintf("Call Variable: %s=%s\n", var_name, var_value);
}
ftdm_iterator_free(iter);
example #2 - accessing a specific variable
------------------------------------------
/* Inside event call-back function */
char *string = NULL;
string = ftdm_sigmsg_get_var(sigmsg, "isdn.prog_ind.descr");
if (string && *string) {
fprintf("Progress indicator:%s\n", string);
}
example #3a - accessing raw data
-------------------------------
/* Inside event call-back function */
ftdm_size_t len;
uint8_t *mydata;
2011-02-25 11:05:11 -05:00
if (ftdm_sigmsg_get_raw_data(sigmsg, (void**)&mydata, &len) == FTDM_SUCCESS) {
/* raw data is available, do something with mydata here */
}
/* Once this function returns, raw data will be free'd inside FreeTDM */
example #3b - accessing raw data
-------------------------------
/* Inside event call-back function */
ftdm_size_t len;
uint8_t *mydata;
2011-02-25 11:05:11 -05:00
if (ftdm_sigmsg_get_raw_data_detached(sigmsg, (void**)&mydata, &len) == FTDM_SUCCESS) {
/* raw data is available, do something with mydata here */
}
:
:
:
/* User owns raw data and is responsible for free'ing it*/
ftdm_safe_free(mydata);