|
|
|
@ -268,6 +268,9 @@ enum {
|
|
|
|
|
IAX_TRUNKTIMESTAMPS = (1 << 22), /*!< Send trunk timestamps */
|
|
|
|
|
IAX_TRANSFERMEDIA = (1 << 23), /*!< When doing IAX2 transfers, transfer media only */
|
|
|
|
|
IAX_MAXAUTHREQ = (1 << 24), /*!< Maximum outstanding AUTHREQ restriction is in place */
|
|
|
|
|
IAX_DELAYPBXSTART = (1 << 25), /*!< Don't start a PBX on the channel until the peer sends us a
|
|
|
|
|
response, so that we've achieved a three-way handshake with
|
|
|
|
|
them before sending voice or anything else*/
|
|
|
|
|
} iax2_flags;
|
|
|
|
|
|
|
|
|
|
static int global_rtautoclear = 120;
|
|
|
|
@ -3258,7 +3261,7 @@ static int iax2_getpeertrunk(struct sockaddr_in sin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*! \brief Create new call, interface with the PBX core */
|
|
|
|
|
static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
|
|
|
|
static struct ast_channel *ast_iax2_new(int callno, int state, int capability, unsigned int delaypbx)
|
|
|
|
|
{
|
|
|
|
|
struct ast_channel *tmp;
|
|
|
|
|
struct chan_iax2_pvt *i;
|
|
|
|
@ -3313,7 +3316,9 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
|
|
|
|
for (v = i->vars ; v ; v = v->next)
|
|
|
|
|
pbx_builtin_setvar_helper(tmp, v->name, v->value);
|
|
|
|
|
|
|
|
|
|
if (state != AST_STATE_DOWN) {
|
|
|
|
|
if (delaypbx) {
|
|
|
|
|
ast_set_flag(i, IAX_DELAYPBXSTART);
|
|
|
|
|
} else if (state != AST_STATE_DOWN) {
|
|
|
|
|
if (ast_pbx_start(tmp)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
|
|
|
|
|
ast_hangup(tmp);
|
|
|
|
@ -6708,6 +6713,16 @@ retryowner:
|
|
|
|
|
ast_log(LOG_DEBUG, "For call=%d, set last=%d\n", fr->callno, fr->ts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ast_test_flag(iaxs[fr->callno], IAX_DELAYPBXSTART)) {
|
|
|
|
|
if (ast_pbx_start(iaxs[fr->callno]->owner)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", iaxs[fr->callno]->owner->name);
|
|
|
|
|
ast_hangup(iaxs[fr->callno]->owner);
|
|
|
|
|
iaxs[fr->callno]->owner = NULL;
|
|
|
|
|
ast_mutex_unlock(&iaxsl[fr->callno]);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(f.subclass) {
|
|
|
|
|
case IAX_COMMAND_ACK:
|
|
|
|
|
/* Do nothing */
|
|
|
|
@ -6916,7 +6931,7 @@ retryowner:
|
|
|
|
|
VERBOSE_PREFIX_4,
|
|
|
|
|
using_prefs);
|
|
|
|
|
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format)))
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format, 1)))
|
|
|
|
|
iax2_destroy(fr->callno);
|
|
|
|
|
} else {
|
|
|
|
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
|
|
|
|
@ -7298,7 +7313,7 @@ retryowner2:
|
|
|
|
|
using_prefs);
|
|
|
|
|
|
|
|
|
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format)))
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, format, 0)))
|
|
|
|
|
iax2_destroy(fr->callno);
|
|
|
|
|
} else {
|
|
|
|
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
|
|
|
|
@ -7326,7 +7341,7 @@ retryowner2:
|
|
|
|
|
ast_verbose(VERBOSE_PREFIX_3 "Accepting DIAL from %s, formats = 0x%x\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat);
|
|
|
|
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
|
|
|
|
send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1);
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat)))
|
|
|
|
|
if(!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat, 0)))
|
|
|
|
|
iax2_destroy(fr->callno);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -8015,7 +8030,7 @@ static struct ast_channel *iax2_request(const char *type, int format, void *data
|
|
|
|
|
if (cai.found)
|
|
|
|
|
ast_string_field_set(iaxs[callno], host, pds.peer);
|
|
|
|
|
|
|
|
|
|
c = ast_iax2_new(callno, AST_STATE_DOWN, cai.capability);
|
|
|
|
|
c = ast_iax2_new(callno, AST_STATE_DOWN, cai.capability, 0);
|
|
|
|
|
|
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
|
|