return(id);
}
+/*
+ * apply options (in locked state)
+ */
+void apply_opt(struct chan_call *call, char *opt)
+{
+}
/*
* enque message to LCR
struct chan_call *call;
ast_mutex_lock(&chan_lock);
-
- CDEBUG(NULL, NULL, "Received request from Asterisk. data=%s\n", (char *)data);
+ CDEBUG(NULL, NULL, "Received request from Asterisk. (data=%s)\n", (char *)data);
/* if socket is closed */
if (lcr_sock < 0)
call->ast = ast;
ast->tech_pvt = call;
ast->fds[0] = call->pipe[0];
- ast_mutex_unlock(&chan_lock);
call->pbx_started = 0;
/* set state */
call->state = CHAN_LCR_STATE_OUT_PREPARE;
}
strncpy(call->interface, interface, sizeof(call->interface)-1);
strncpy(call->dialstring, dial, sizeof(call->dialstring)-1);
+ apply_opt(call, (char *)opt);
-#warning todo: parse options
-
+ ast_mutex_unlock(&chan_lock);
return ast;
}
}
ast_mutex_unlock(&chan_lock);
-
return(0);
}
memset(&newparam, 0, sizeof(union parameter));
newparam.notifyinfo.notify = INFO_NOTIFY_REMOTE_HOLD;
send_message(MESSAGE_NOTIFY, call->ref, &newparam);
+
+ /*start music onhold*/
+ ast_moh_start(ast,data,ast->musicclass);
break;
case AST_CONTROL_UNHOLD:
CDEBUG(call, ast, "Received indicate AST_CONTROL_UNHOLD from Asterisk.\n");
memset(&newparam, 0, sizeof(union parameter));
newparam.notifyinfo.notify = INFO_NOTIFY_REMOTE_RETRIEVAL;
send_message(MESSAGE_NOTIFY, call->ref, &newparam);
- break;
+
+ /*stop moh*/
+ ast_moh_stop(ast);
+ break;
default:
CERROR(call, ast, "Received indicate from Asterisk with unknown condition %d.\n", cond);
call2->bridge_call->bridge_call = NULL;
call2->bridge_call = NULL;
}
+
ast_mutex_unlock(&chan_lock);
-
-
return AST_BRIDGE_COMPLETE;
}
static struct ast_channel_tech lcr_tech = {
#endif
+
+static int lcr_config_exec(struct ast_channel *ast, void *data)
+{
+ struct chan_call *call;
+
+ ast_mutex_lock(&chan_lock);
+ CDEBUG(NULL, ast, "Received lcr_config (data=%s)\n", (char *)data);
+ /* find channel */
+ call = call_first;
+ while(call) {
+ if (call->ast == ast)
+ break;
+ call = call->next;
+ }
+ if (call)
+ apply_opt(call, (char *)data);
+ else
+ CERROR(NULL, ast, "lcr_config app not called by chan_lcr channel.\n");
+
+ ast_mutex_unlock(&chan_lock);
+ return 0;
+}
+
/*
* module loading and destruction
*/
close_socket();
return AST_MODULE_LOAD_DECLINE;
}
+
+ ast_register_application("lcr_config", lcr_config_exec, "lcr_config",
+ "lcr_config(:<opt>=<optarg>:<opt>:...):\n"
+ "Sets LCR opts. and optargs\n"
+ "\n"
+ "The available options are:\n"
+ " d - Send display text on called phone, text is the optparam\n"
+ " n - Don't detect dtmf tones on called channel\n"
+ " h - Make digital outgoing call\n"
+ " c - Make crypted outgoing call, optarg is keyindex\n"
+ " e - Perform echo cancelation on this channel,\n"
+ " Takes taps as arguments (32,64,128,256)\n"
+ " s - Send Non Inband DTMF as inband\n"
+ " vr - rxgain control\n"
+ " vt - txgain control\n"
+ " Volume changes at factor 2 ^ optarg\n"
+ " pt - Disable all audio features (required for fax application)\n"
+ );
+
#if 0
ast_cli_register(&cli_show_lcr);
ast_cli_register(&cli_show_calls);
-
ast_cli_register(&cli_reload_routing);
ast_cli_register(&cli_reload_interfaces);
ast_cli_register(&cli_port_block);
ast_cli_register(&cli_port_unblock);
ast_cli_register(&cli_port_unload);
-
- ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
- "misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
- "Sets mISDN opts. and optargs\n"
- "\n"
- "The available options are:\n"
- " d - Send display text on called phone, text is the optparam\n"
- " n - don't detect dtmf tones on called channel\n"
- " h - make digital outgoing call\n"
- " c - make crypted outgoing call, param is keyindex\n"
- " e - perform echo cancelation on this channel,\n"
- " takes taps as arguments (32,64,128,256)\n"
- " s - send Non Inband DTMF as inband\n"
- " vr - rxgain control\n"
- " vt - txgain control\n"
- );
-
-
- lcr_cfg_get( 0, LCR_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
-
-=======
- //lcr_cfg_get( 0, LCR_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
#endif
quit = 0;
ast_channel_unregister(&lcr_tech);
+ ast_unregister_application("lcr_config");
+
+
if (mISDN_created) {
bchannel_deinitialize();
mISDN_created = 0;