mod_portaudio: add context param

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14737 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2009-09-02 15:37:11 +00:00
parent 325cceffc3
commit 33c3ad8dd8
1 changed files with 12 additions and 1 deletions

View File

@ -99,6 +99,7 @@ static struct {
char *cid_name; char *cid_name;
char *cid_num; char *cid_num;
char *dialplan; char *dialplan;
char *context;
char *ring_file; char *ring_file;
char *hold_file; char *hold_file;
char *timer_name; char *timer_name;
@ -137,6 +138,7 @@ static struct {
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_name, globals.cid_name);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_cid_num, globals.cid_num);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ring_file, globals.ring_file);
@ -903,6 +905,8 @@ static switch_status_t load_config(void)
} }
} else if (!strcmp(var, "dialplan")) { } else if (!strcmp(var, "dialplan")) {
set_global_dialplan(val); set_global_dialplan(val);
} else if (!strcmp(var, "context")) {
set_global_context(val);
} else if (!strcmp(var, "cid-name")) { } else if (!strcmp(var, "cid-name")) {
set_global_cid_name(val); set_global_cid_name(val);
} else if (!strcmp(var, "cid-num")) { } else if (!strcmp(var, "cid-num")) {
@ -933,6 +937,10 @@ static switch_status_t load_config(void)
set_global_dialplan("default"); set_global_dialplan("default");
} }
if (!globals.context) {
set_global_context("default");
}
if (!globals.sample_rate) { if (!globals.sample_rate) {
globals.sample_rate = 8000; globals.sample_rate = 8000;
} }
@ -994,6 +1002,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
switch_event_free_subclass(MY_EVENT_RINGING); switch_event_free_subclass(MY_EVENT_RINGING);
switch_safe_free(globals.dialplan); switch_safe_free(globals.dialplan);
switch_safe_free(globals.context);
switch_safe_free(globals.cid_name); switch_safe_free(globals.cid_name);
switch_safe_free(globals.cid_num); switch_safe_free(globals.cid_num);
switch_safe_free(globals.ring_file); switch_safe_free(globals.ring_file);
@ -1493,6 +1502,7 @@ static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t
char *callid = argv[0]; char *callid = argv[0];
uint8_t one_call = 0; uint8_t one_call = 0;
switch_mutex_lock(globals.pvt_lock); switch_mutex_lock(globals.pvt_lock);
if (switch_strlen_zero(callid)) { if (switch_strlen_zero(callid)) {
if (globals.call_list) { if (globals.call_list) {
@ -1717,6 +1727,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
private_t *tech_pvt; private_t *tech_pvt;
switch_channel_t *channel; switch_channel_t *channel;
char *dialplan = globals.dialplan; char *dialplan = globals.dialplan;
char *context = globals.context;
char *cid_name = globals.cid_name; char *cid_name = globals.cid_name;
char *cid_num = globals.cid_num; char *cid_num = globals.cid_num;
char ip[25] = "0.0.0.0"; char ip[25] = "0.0.0.0";
@ -1758,7 +1769,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET); switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET);
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) { NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, context, dest)) != 0) {
char name[128]; char name[128];
switch_snprintf(name, sizeof(name), "portaudio/%s", switch_snprintf(name, sizeof(name), "portaudio/%s",
tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname); tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);