mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
why malloc?
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3204 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d58c1d05b9
commit
ee086006d5
@ -3626,7 +3626,7 @@ static void sip_i_info(nua_t *nua,
|
|||||||
if(signal_ptr) {
|
if(signal_ptr) {
|
||||||
struct private_object *tech_pvt = NULL;
|
struct private_object *tech_pvt = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
char *dtmf_digit;
|
char dtmf_digit[2] = {0,0};
|
||||||
|
|
||||||
//Get the channel
|
//Get the channel
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
@ -3640,26 +3640,18 @@ static void sip_i_info(nua_t *nua,
|
|||||||
//Barf if we didn't get it
|
//Barf if we didn't get it
|
||||||
assert(tech_pvt != NULL);
|
assert(tech_pvt != NULL);
|
||||||
|
|
||||||
//holder for the dtmf digit
|
|
||||||
dtmf_digit = malloc(sizeof(char) * 2);
|
|
||||||
|
|
||||||
//move signal_ptr where we need it (right past Signal=)
|
//move signal_ptr where we need it (right past Signal=)
|
||||||
signal_ptr = signal_ptr + 7;
|
signal_ptr = signal_ptr + 7;
|
||||||
|
|
||||||
//put the digit somewhere we can muck with
|
//put the digit somewhere we can muck with
|
||||||
strncpy(dtmf_digit, signal_ptr, 1);
|
strncpy(dtmf_digit, signal_ptr, 1);
|
||||||
|
|
||||||
//End the string
|
|
||||||
*(dtmf_digit + 1) = '\0';
|
|
||||||
|
|
||||||
//queue it up
|
//queue it up
|
||||||
switch_channel_queue_dtmf(channel, dtmf_digit);
|
switch_channel_queue_dtmf(channel, dtmf_digit);
|
||||||
|
|
||||||
//print debug info
|
//print debug info
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%s)\n", dtmf_digit);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%s)\n", dtmf_digit);
|
||||||
|
|
||||||
//Give back the memory I borrowed
|
|
||||||
free(dtmf_digit);
|
|
||||||
} else { //unknown info type
|
} else { //unknown info type
|
||||||
sip_from_t const *from;
|
sip_from_t const *from;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user