diff -d -u -r1.5 chan_sip.c --- channels/chan_sip.c 6 Aug 2008 11:05:37 -0000 1.5 +++ channels/chan_sip.c 15 Sep 2008 13:48:33 -0000 @@ -797,6 +797,7 @@ #define SIP_PAGE2_RFC2833_COMPENSATE (1 << 25) /*!< 25: ???? */ #define SIP_PAGE2_BUGGY_MWI (1 << 26) /*!< 26: Buggy CISCO MWI fix */ #define SIP_PAGE2_OUTGOING_CALL (1 << 27) /*!< 27: Is this an outgoing call? */ +#define SIP_PAGE2_GOT_OK_FOR_INVITE (1 << 31) /*!< 31: Got OK for INVITE? */ #define SIP_PAGE2_FLAGS_TO_COPY \ (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \ @@ -12276,6 +12298,7 @@ } if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->owner) { + ast_set_flag(&p->flags[1], SIP_PAGE2_GOT_OK_FOR_INVITE); if (!reinvite) { ast_queue_control(p->owner, AST_CONTROL_ANSWER); } else { /* RE-invite */ @@ -13773,7 +13796,8 @@ } /* Check if this is a loop */ - if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner && (p->owner->_state != AST_STATE_UP)) { + if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner && (p->owner->_state != AST_STATE_UP) + && !ast_test_flag(&p->flags[1], SIP_PAGE2_GOT_OK_FOR_INVITE)) { /* This is a call to ourself. Send ourselves an error code and stop processing immediately, as SIP really has no good mechanism for being able to call yourself */