#include <semaphore.h>
+#define HAVE_ATTRIBUTE_always_inline 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_TIMERSUB 1
+
+#include <asterisk/compiler.h>
+#include <asterisk/buildopts.h>
#include <asterisk/module.h>
#include <asterisk/channel.h>
#include <asterisk/config.h>
}
switch(ast->cid.cid_pres & AST_PRES_RESTRICTION)
{
- case AST_PRES_ALLOWED:
- newparam.setup.callerinfo.present = INFO_PRESENT_ALLOWED;
- break;
case AST_PRES_RESTRICTED:
newparam.setup.callerinfo.present = INFO_PRESENT_RESTRICTED;
break;
case AST_PRES_UNAVAILABLE:
newparam.setup.callerinfo.present = INFO_PRESENT_NOTAVAIL;
break;
+ case AST_PRES_ALLOWED:
default:
- newparam.setup.callerinfo.present = INFO_PRESENT_NULL;
+ newparam.setup.callerinfo.present = INFO_PRESENT_ALLOWED;
}
switch(ast->cid.cid_ton)
{
/* check bridge */
if (!call) return;
if (!call->bridge_call) return;
- CDEBUG(call, NULL, "Sending message due briding.\n");
+ CDEBUG(call, NULL, "Sending message due bridging.\n");
send_message(message_type, call->bridge_call->ref, param);
}
{
int cause, ret;
union parameter newparam;
+ char *exten = ast->exten;
+ if (!*exten)
+ exten = "s";
- CDEBUG(call, ast, "Try to start pbx. (exten=%s context=%s complete=%s)\n", ast->exten, ast->context, complete?"yes":"no");
+ CDEBUG(call, ast, "Try to start pbx. (exten=%s context=%s complete=%s)\n", exten, ast->context, complete?"yes":"no");
if (complete)
{
/* if not match */
- if (!ast_canmatch_extension(ast, ast->context, ast->exten, 1, call->oad))
+ if (!ast_canmatch_extension(ast, ast->context, exten, 1, call->oad))
{
- CDEBUG(call, ast, "Got 'sending complete', but extension '%s' will not match at context '%s' - releasing.\n", ast->exten, ast->context);
+ CDEBUG(call, ast, "Got 'sending complete', but extension '%s' will not match at context '%s' - releasing.\n", exten, ast->context);
cause = 1;
goto release;
}
- if (!ast_exists_extension(ast, ast->context, ast->exten, 1, call->oad))
+ if (!ast_exists_extension(ast, ast->context, exten, 1, call->oad))
{
- CDEBUG(call, ast, "Got 'sending complete', but extension '%s' would match at context '%s', if more digits would be dialed - releasing.\n", ast->exten, ast->context);
+ CDEBUG(call, ast, "Got 'sending complete', but extension '%s' would match at context '%s', if more digits would be dialed - releasing.\n", exten, ast->context);
cause = 28;
goto release;
}
goto start;
}
- if (ast_canmatch_extension(ast, ast->context, ast->exten, 1, call->oad))
+ if (ast_canmatch_extension(ast, ast->context, exten, 1, call->oad))
{
/* send setup acknowledge to lcr */
if (call->state != CHAN_LCR_STATE_IN_DIALING) {
call->state = CHAN_LCR_STATE_IN_DIALING;
/* if match, start pbx */
- if (ast_exists_extension(ast, ast->context, ast->exten, 1, call->oad)) {
+ if (ast_exists_extension(ast, ast->context, exten, 1, call->oad)) {
CDEBUG(call, ast, "Extensions matches.\n");
goto start;
}
return;
}
+ if (!*ast->exten) {
+ /* if can match */
+ CDEBUG(call, ast, "There is no 's' extension (and we tried to match it implicitly). Extensions may match, if more digits are dialed.\n");
+ return;
+ }
+
/* if not match */
cause = 1;
release:
goto release;
}
call->pbx_started = 1;
-// if (call->state == CHAN_LCR_STATE_IN_DIALING)
- ast_setstate(ast, AST_STATE_RINGING);
-// else
-// ast_setstate(ast, AST_STATE_RINGING);
-// return;
+ ast_setstate(ast, AST_STATE_RING);
}
/*
/* use bridge to forware message not supported by asterisk */
if (call->state == CHAN_LCR_STATE_CONNECT) {
- CDEBUG(call, call->ast, "Call is connected, briding.\n");
+ CDEBUG(call, call->ast, "Call is connected, bridging.\n");
bridge_message_if_bridged(call, message_type, param);
}
}
case 'R':
CDEBUG(call, ast, "Sending queued RINGING to Asterisk.\n");
ast_queue_control(ast, AST_CONTROL_RINGING);
+ ast_setstate(ast, AST_STATE_RINGING);
break;
case 'A':
CDEBUG(call, ast, "Sending queued ANSWER to Asterisk.\n");
/* during prepare, we change to release state */
CDEBUG(call, ast, "We must wait until we received our ref, until we can free call instance.\n");
call->state = CHAN_LCR_STATE_RELEASE;
+ call->ast = NULL;
}
}
if (!pthread_equal(tid, chan_tid))
return -1;
}
if (call->bchannel && f->samples)
- bchannel_transmit(call->bchannel, f->data, f->samples);
+ bchannel_transmit(call->bchannel, (unsigned char *)f->data, f->samples);
ast_mutex_unlock(&chan_lock);
return 0;
}
call->read_fr.datalen = len;
call->read_fr.samples = len;
call->read_fr.delivery = ast_tv(0,0);
- call->read_fr.data = call->read_buff;
+ (unsigned char *)call->read_fr.data = call->read_buff;
ast_mutex_unlock(&chan_lock);
return &call->read_fr;
break;
#ifdef AST_CONTROL_SRCUPDATE
case AST_CONTROL_SRCUPDATE:
- CDEBUG(call, ast, "Received indicate AST_CONTROL_SRCUPDATE from Asterisk.\n");
- res = -1;
+ CDEBUG(call, ast, "Received AST_CONTROL_SRCUPDATE from Asterisk.\n");
break;
#endif
default:
struct ast_frame *f;
int bridge_id;
- CDEBUG(NULL, NULL, "Received briding request from Asterisk.\n");
+ CDEBUG(NULL, NULL, "Received bridging request from Asterisk.\n");
carr[0] = ast1;
carr[1] = ast2;
/* join, if both call instances uses dsp */
if (!call1->nodsp && !call2->nodsp) {
- CDEBUG(NULL, NULL, "Both calls use DSP, briding via DSP.\n");
+ CDEBUG(NULL, NULL, "Both calls use DSP, bridging via DSP.\n");
/* get bridge id and join */
bridge_id = new_bridge_id();
bchannel_join(call2->bchannel, bridge_id);
} else
if (call1->nodsp && call2->nodsp)
- CDEBUG(NULL, NULL, "Both calls use no DSP, briding in channel driver.\n");
+ CDEBUG(NULL, NULL, "Both calls use no DSP, bridging in channel driver.\n");
else
- CDEBUG(NULL, NULL, "One call uses no DSP, briding in channel driver.\n");
+ CDEBUG(NULL, NULL, "One call uses no DSP, bridging in channel driver.\n");
call1->bridge_call = call2;
call2->bridge_call = call1;
}
- CDEBUG(NULL, NULL, "Releasing bride.\n");
+ CDEBUG(NULL, NULL, "Releasing bridge.\n");
/* split channels */
ast_mutex_lock(&chan_lock);
}
static struct ast_channel_tech lcr_tech = {
.type="LCR",
- .description="Channel driver for connecting to Linux-Call-Router",
- .requester=lcr_request,
- .send_digit_begin=lcr_digit_begin,
- .send_digit_end=lcr_digit_end,
- .call=lcr_call,
- .bridge=lcr_bridge,
- .hangup=lcr_hangup,
- .answer=lcr_answer,
- .read=lcr_read,
- .write=lcr_write,
- .indicate=lcr_indicate,
- .fixup=lcr_fixup,
- .send_text=lcr_send_text,
- .properties=0
+ .description = "Channel driver for connecting to Linux-Call-Router",
+ .capabilities = AST_FORMAT_ALAW,
+ .requester = lcr_request,
+ .send_digit_begin = lcr_digit_begin,
+ .send_digit_end = lcr_digit_end,
+ .call = lcr_call,
+ .bridge = lcr_bridge,
+ .hangup = lcr_hangup,
+ .answer = lcr_answer,
+ .read = lcr_read,
+ .write = lcr_write,
+ .indicate = lcr_indicate,
+ .fixup = lcr_fixup,
+ .send_text = lcr_send_text,
+ .properties = 0
};