--- channels/chan_iax2.c.orig 2009-01-06 16:46:02.000000000 -0500 +++ channels/chan_iax2.c 2009-01-23 09:03:48.000000000 -0500 @@ -279,7 +279,8 @@ 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*/ - IAX_ALLOWFWDOWNLOAD = (1 << 26), /*!< Allow the FWDOWNL command? */ + IAX_ALLOWFWDOWNLOAD = (1 << 26), /*!< Allow the FWDOWNL command? */ + IAX_IMMEDIATE = (1 << 27), /*!< Allow immediate off-hook to extension s */ }; static int global_rtautoclear = 120; @@ -5985,6 +5986,7 @@ ast_set_flag(iaxs[callno], IAX_MAXAUTHREQ); iaxs[callno]->prefs = user->prefs; ast_copy_flags(iaxs[callno], user, IAX_CODEC_USER_FIRST); + ast_copy_flags(iaxs[callno], user, IAX_IMMEDIATE); ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOPREFS); ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOCAP); iaxs[callno]->encmethods = user->encmethods; @@ -7085,7 +7087,7 @@ /* SLD: third call to find_peer in registration */ ast_mutex_unlock(&iaxsl[callno]); - if (p = find_peer(peer_name, 1)) { + if ((p = find_peer(peer_name, 1))) { last_authmethod = p->authmethods; } @@ -8179,6 +8181,24 @@ } if (fr->callno > 0) ast_mutex_unlock(&iaxsl[fr->callno]); + else { + if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_INVAL && + dcallno && iaxs[dcallno] && iaxs[dcallno]->peerpoke) { + peer = iaxs[dcallno]->peerpoke; + if (peer->pokeexpire > -1) { + if (!ast_sched_del(sched, peer->pokeexpire)) { + peer->pokeexpire = -1; + peer_unref(peer); + } + /* Now schedule another poke */ + peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqok, iax2_poke_peer_s, peer_ref(peer)); + if (peer->pokeexpire == -1) + peer_unref(peer); + } + iax2_destroy(dcallno); + peer->callno = 0; + } + } return 1; } if (ast_test_flag(iaxs[fr->callno], IAX_ENCRYPTED)) { @@ -9237,10 +9257,12 @@ ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD); /* If this is a TBD call, we're ready but now what... */ ast_verb(3, "Accepted AUTHENTICATED TBD call from %s\n", ast_inet_ntoa(sin.sin_addr)); + if (ast_test_flag(iaxs[fr->callno], IAX_IMMEDIATE)) goto immediatedial; } } } break; + immediatedial: case IAX_COMMAND_DIAL: if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD)) { ast_clear_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD); @@ -10758,6 +10780,8 @@ ast_set_flag(user, IAX_CODEC_NOCAP); ast_set_flag(user, IAX_CODEC_NOPREFS); } + } else if (!strcasecmp(v->name, "immediate")) { + ast_set2_flag(user, ast_true(v->value), IAX_IMMEDIATE); } else if (!strcasecmp(v->name, "jitterbuffer")) { ast_set2_flag(user, ast_true(v->value), IAX_USEJITTERBUF); } else if (!strcasecmp(v->name, "forcejitterbuffer")) { @@ -11112,6 +11136,8 @@ } } else if (!strcasecmp(v->name, "authdebug")) authdebug = ast_true(v->value); + else if (!strcasecmp(v->name, "debug")) + iaxdebug = ast_true(v->value); else if (!strcasecmp(v->name, "encryption")) iax2_encryption = get_encrypt_methods(v->value); else if (!strcasecmp(v->name, "transfer")) {