@ -1273,7 +1273,9 @@ static int retrans_pkt(void *data)
ast_mutex_unlock ( & pkt - > owner - > owner - > lock ) ;
} else {
/* If no channel owner, destroy now */
ast_set_flag ( pkt - > owner , SIP_NEEDDESTROY ) ;
/* Let the peerpoke system expire packets when the timer expires for poke_noanswer */
if ( pkt - > method ! = SIP_OPTIONS )
ast_set_flag ( pkt - > owner , SIP_NEEDDESTROY ) ;
}
}
/* In any case, go ahead and remove the packet */
@ -1426,6 +1428,7 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
if ( sipdebug & & option_debug > 3 )
ast_log ( LOG_DEBUG , " ** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d \n " , cur - > retransid ) ;
ast_sched_del ( sched , cur - > retransid ) ;
cur - > retransid = - 1 ;
}
free ( cur ) ;
res = 0 ;
@ -1481,8 +1484,8 @@ static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
if ( option_debug > 3 & & sipdebug )
ast_log ( LOG_DEBUG , " *** SIP TIMER: Cancelling retransmission #%d - %s (got response) \n " , cur - > retransid , msg ) ;
ast_sched_del ( sched , cur - > retransid ) ;
cur - > retransid = - 1 ;
}
cur - > retransid = - 1 ;
res = 0 ;
break ;
}
@ -1681,6 +1684,7 @@ static void sip_destroy_peer(struct sip_peer *peer)
}
if ( peer - > expire > - 1 )
ast_sched_del ( sched , peer - > expire ) ;
if ( peer - > pokeexpire > - 1 )
ast_sched_del ( sched , peer - > pokeexpire ) ;
register_peer_exten ( peer , 0 ) ;
@ -2289,7 +2293,7 @@ static int update_call_counter(struct sip_pvt *fup, int event)
case INC_CALL_LIMIT :
if ( * call_limit > 0 ) {
if ( * inuse > = * call_limit ) {
ast_log ( LOG_ ERROR , " Call %s %s '%s' rejected due to usage limit of %d \n " , outgoing ? " to " : " from " , u ? " user " : " peer " , name , * call_limit ) ;
ast_log ( LOG_ NOTIC E, " Call %s %s '%s' rejected due to usage limit of %d \n " , outgoing ? " to " : " from " , u ? " user " : " peer " , name , * call_limit ) ;
if ( u )
ASTOBJ_UNREF ( u , sip_destroy_user ) ;
else
@ -2518,7 +2522,7 @@ static int sip_hangup(struct ast_channel *ast)
/* Do we need a timer here if we don't hear from them at all? */
} else {
/* Send a new request: CANCEL */
transmit_request _with_auth ( p , SIP_CANCEL , p - > ocseq , 1 , 0 ) ;
transmit_request ( p , SIP_CANCEL , p - > ocseq , 1 , 0 ) ;
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE , but do set an autodestruct just in case we never get it . */
}
@ -2592,7 +2596,7 @@ static int sip_answer(struct ast_channel *ast)
ast_setstate ( ast , AST_STATE_UP ) ;
if ( option_debug )
ast_log ( LOG_DEBUG , " sip_answer(%s) \n " , ast - > name ) ;
res = transmit_response_with_sdp ( p , " 200 OK " , & p - > initreq , 1 ) ;
res = transmit_response_with_sdp ( p , " 200 OK " , & p - > initreq , 2 ) ;
}
ast_mutex_unlock ( & p - > lock ) ;
return res ;
@ -2655,6 +2659,11 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
static int sip_fixup ( struct ast_channel * oldchan , struct ast_channel * newchan )
{
struct sip_pvt * p = newchan - > tech_pvt ;
if ( ! p ) {
ast_log ( LOG_WARNING , " No pvt after masquerade. Strange things may happen \n " ) ;
return - 1 ;
}
ast_mutex_lock ( & p - > lock ) ;
if ( p - > owner ! = oldchan ) {
ast_log ( LOG_WARNING , " old channel wasn't %p but was %p \n " , oldchan , p - > owner ) ;
@ -3278,9 +3287,10 @@ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *si
ast_mutex_unlock ( & iflock ) ;
/* If this is a response and we have ignoring of out of dialog responses turned on, then drop it */
/* ...and never respond to a SIP ACK message */
if ( ! sip_methods [ intended_method ] . can_create ) {
/* Can't create dialog */
if ( intended_method ! = SIP_RESPONSE )
if ( intended_method ! = SIP_RESPONSE & & intended_method ! = SIP_ACK )
transmit_response_using_temp ( callid , sin , 1 , intended_method , req , " 481 Call leg/transaction does not exist " ) ;
} else if ( sip_methods [ intended_method ] . can_create = = 2 ) {
char * response = " 481 Call leg/transaction does not exist " ;
@ -3298,6 +3308,19 @@ static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *si
p = sip_alloc ( callid , sin , 1 , intended_method ) ;
if ( p )
ast_mutex_lock ( & p - > lock ) ;
else {
/* We have a memory or file/socket error (can't allocate RTP sockets or something) so we're not
getting a dialog from sip_alloc .
Without a dialog we can ' t retransmit and handle ACKs and all that , but at least
send an error message .
Sorry , we apologize for the inconvienience
*/
transmit_response_using_temp ( callid , sin , 1 , intended_method , req , " 500 Server internal error " ) ;
if ( option_debug > 3 )
ast_log ( LOG_DEBUG , " Failed allocating SIP dialog, sending 500 Server internal error and giving up \n " ) ;
}
}
return p ;
@ -3541,7 +3564,9 @@ static int find_sdp(struct sip_request *req)
for ( x = 0 ; x < ( req - > lines - 2 ) ; x + + ) {
if ( ! strncasecmp ( req - > line [ x ] , boundary , strlen ( boundary ) ) & &
! strcasecmp ( req - > line [ x + 1 ] , " Content-Type: application/sdp " ) ) {
req - > sdp_start = x + 2 ;
x + = 2 ;
req - > sdp_start = x ;
/* search for the end of the body part */
for ( ; x < req - > lines ; x + + ) {
if ( ! strncasecmp ( req - > line [ x ] , boundary , strlen ( boundary ) ) )
@ -4272,7 +4297,8 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
add_header ( req , " From " , ot ) ;
add_header ( req , " To " , of ) ;
}
add_header ( req , " Contact " , p - > our_contact ) ;
if ( sipmethod ! = SIP_BYE & & sipmethod ! = SIP_CANCEL & & sipmethod ! = SIP_MESSAGE )
add_header ( req , " Contact " , p - > our_contact ) ;
copy_header ( req , orig , " Call-ID " ) ;
add_header ( req , " CSeq " , tmp ) ;
@ -4310,6 +4336,7 @@ static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request
static int transmit_response_using_temp ( char * callid , struct sockaddr_in * sin , int useglobal_nat , const int intended_method , struct sip_request * req , char * msg )
{
struct sip_pvt * p = alloca ( sizeof ( * p ) ) ;
struct sip_history * hist = NULL ;
memset ( p , 0 , sizeof ( * p ) ) ;
@ -4335,6 +4362,11 @@ static int transmit_response_using_temp(char *callid, struct sockaddr_in *sin, i
__transmit_response ( p , msg , req , 0 ) ;
while ( ( hist = p - > history ) ) {
p - > history = p - > history - > next ;
free ( hist ) ;
}
return 0 ;
}
@ -5717,7 +5749,8 @@ static int transmit_register(struct sip_registry *r, int sipmethod, char *auth,
ast_copy_string ( p - > domain , r - > domain , sizeof ( p - > domain ) ) ;
ast_copy_string ( p - > opaque , r - > opaque , sizeof ( p - > opaque ) ) ;
ast_copy_string ( p - > qop , r - > qop , sizeof ( p - > qop ) ) ;
p - > noncecount = r - > noncecount + + ;
r - > noncecount + + ;
p - > noncecount = r - > noncecount ;
memset ( digest , 0 , sizeof ( digest ) ) ;
if ( ! build_reply_digest ( p , sipmethod , digest , sizeof ( digest ) ) )
@ -6165,8 +6198,10 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
else
p - > username [ 0 ] = ' \0 ' ;
if ( p - > expire > - 1 )
if ( p - > expire > - 1 ) {
ast_sched_del ( sched , p - > expire ) ;
p - > expire = - 1 ;
}
if ( ( expiry < 1 ) | | ( expiry > max_expiry ) )
expiry = max_expiry ;
if ( ! ast_test_flag ( p , SIP_REALTIME ) )
@ -8217,7 +8252,7 @@ static int _sip_show_peer(int type, int fd, struct mansession *s, struct message
print_group ( fd , peer - > pickupgroup , 0 ) ;
ast_cli ( fd , " Mailbox : %s \n " , peer - > mailbox ) ;
ast_cli ( fd , " VM Extension : %s \n " , peer - > vmexten ) ;
ast_cli ( fd , " LastMsgsSent : %d \n " , peer - > lastmsgssent ) ;
ast_cli ( fd , " LastMsgsSent : %d /%d \n " , ( peer - > lastmsgssent & 0x7fff0000 ) > > 16 , peer - > lastmsgssent & 0xffff ) ;
ast_cli ( fd , " Call limit : %d \n " , peer - > call_limit ) ;
ast_cli ( fd , " Dynamic : %s \n " , ( ast_test_flag ( & peer - > flags_page2 , SIP_PAGE2_DYNAMIC ) ? " Yes " : " No " ) ) ;
ast_cli ( fd , " Callerid : %s \n " , ast_callerid_merge ( cbuf , sizeof ( cbuf ) , peer - > cid_name , peer - > cid_num , " <unspecified> " ) ) ;
@ -9718,7 +9753,7 @@ static void check_pendings(struct sip_pvt *p)
if ( ast_test_flag ( p , SIP_PENDINGBYE ) ) {
/* if we can't BYE, then this is really a pending CANCEL */
if ( ! ast_test_flag ( p , SIP_CAN_BYE ) )
transmit_request _with_auth ( p , SIP_CANCEL , p - > ocseq , 1 , 0 ) ;
transmit_request ( p , SIP_CANCEL , p - > ocseq , 1 , 0 ) ;
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE , but do set an autodestruct just in case we never get it . */
else
@ -9889,12 +9924,23 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
ast_log ( LOG_WARNING , " Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up. \n " , p - > callid ) ;
transmit_request ( p , SIP_ACK , seqno , 0 , 0 ) ;
break ;
case 487 : /* Cancelled transaction */
/* We have sent CANCEL on an outbound INVITE
This transaction is already scheduled to be killed by sip_hangup ( ) .
*/
transmit_request ( p , SIP_ACK , seqno , 0 , 0 ) ;
if ( p - > owner & & ! ignore )
ast_queue_hangup ( p - > owner ) ;
else if ( ! ignore )
update_call_counter ( p , DEC_CALL_LIMIT ) ;
break ;
case 491 : /* Pending */
/* we have to wait a while, then retransmit */
/* Transmission is rescheduled, so everything should be taken care of.
We should support the retry - after at some point */
break ;
case 501 : /* Not implemented */
transmit_request ( p , SIP_ACK , seqno , 0 , 0 ) ;
if ( p - > owner )
ast_queue_control ( p - > owner , AST_CONTROL_CONGESTION ) ;
break ;
@ -9920,6 +9966,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
if ( global_regattempts_max )
p - > registry - > regattempts = global_regattempts_max + 1 ;
ast_sched_del ( sched , r - > timeout ) ;
r - > timeout = - 1 ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
break ;
case 404 : /* Not found */
@ -9929,6 +9976,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
r - > call = NULL ;
ast_sched_del ( sched , r - > timeout ) ;
r - > timeout = - 1 ;
break ;
case 407 : /* Proxy auth */
if ( ( p - > authtries = = MAX_AUTHTRIES ) | | do_register_auth ( p , req , " Proxy-Authenticate " , " Proxy-Authorization " ) ) {
@ -9943,6 +9991,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
r - > call = NULL ;
ast_sched_del ( sched , r - > timeout ) ;
r - > timeout = - 1 ;
break ;
case 200 : /* 200 OK */
if ( ! r ) {
@ -10062,7 +10111,7 @@ static int handle_response_peerpoke(struct sip_pvt *p, int resp, char *rest, str
ast_sched_del ( sched , peer - > pokeexpire ) ;
if ( sipmethod = = SIP_INVITE ) /* Does this really happen? */
transmit_request ( p , SIP_ACK , seqno , 0 , 0 ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
/* Try again eventually */
if ( ( peer - > lastms < 0 ) | | ( peer - > lastms > peer - > maxms ) )
@ -10199,6 +10248,10 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
break ;
case 487 :
if ( sipmethod = = SIP_INVITE )
handle_response_invite ( p , resp , rest , req , ignore , seqno ) ;
break ;
case 491 : /* Pending */
if ( sipmethod = = SIP_INVITE ) {
handle_response_invite ( p , resp , rest , req , ignore , seqno ) ;
@ -10213,7 +10266,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
if ( ( resp > = 300 ) & & ( resp < 700 ) ) {
if ( ( option_verbose > 2 ) & & ( resp ! = 487 ) )
ast_verbose ( VERBOSE_PREFIX_3 " Got SIP response %d \" %s \" back from %s \n " , resp , rest , ast_inet_ntoa ( iabuf , sizeof ( iabuf ) , p - > sa . sin_addr ) ) ;
ast_set_flag ( p , SIP_ALREADYGONE ) ;
if ( p - > rtp ) {
/* Immediately stop RTP */
ast_rtp_stop ( p - > rtp ) ;
@ -10236,12 +10288,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
if ( p - > owner )
ast_queue_control ( p - > owner , AST_CONTROL_BUSY ) ;
break ;
case 487 :
/* channel now destroyed - dec the inUse counter */
if ( owner )
ast_queue_hangup ( p - > owner ) ;
update_call_counter ( p , DEC_CALL_LIMIT ) ;
break ;
case 482 : /* SIP is incapable of performing a hairpin call, which
is yet another failure of not having a layer 2 ( again , YAY
IETF for thinking ahead ) . So we treat this as a call
@ -10612,8 +10658,9 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
/* 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 */
transmit_response ( p , " 482 Loop Detected " , req ) ;
/* We do NOT destroy p here, so that our response will be accepted */
transmit_response_reliable ( p , " 482 Loop Detected " , req , 1 ) ;
if ( ! p - > lastinvite )
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
return 0 ;
}
if ( ! ignore ) {
@ -10655,10 +10702,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
transmit_fake_auth_response ( p , req , p - > randdata , sizeof ( p - > randdata ) , 1 ) ;
} else {
ast_log ( LOG_NOTICE , " Failed to authenticate user %s \n " , get_header ( req , " From " ) ) ;
if ( ignore )
transmit_response ( p , " 403 Forbidden " , req ) ;
else
transmit_response_reliable ( p , " 403 Forbidden " , req , 1 ) ;
transmit_response_reliable ( p , " 403 Forbidden " , req , 1 ) ;
}
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
p - > theirtag [ 0 ] = ' \0 ' ; /* Forget their to-tag, we'll get a new one */
@ -10700,10 +10744,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
if ( res ) {
if ( res < 0 ) {
ast_log ( LOG_NOTICE , " Failed to place call for user %s, too many calls \n " , p - > username ) ;
if ( ignore )
transmit_response ( p , " 480 Temporarily Unavailable (Call limit) " , req ) ;
else
transmit_response_reliable ( p , " 480 Temporarily Unavailable (Call limit) " , req , 1 ) ;
transmit_response_reliable ( p , " 480 Temporarily Unavailable (Call limit) " , req , 1 ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
}
return 0 ;
@ -10716,20 +10757,13 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
build_contact ( p ) ;
if ( gotdest ) {
if ( gotdest < 0 ) {
if ( ignore )
transmit_response ( p , " 404 Not Found " , req ) ;
else
transmit_response_reliable ( p , " 404 Not Found " , req , 1 ) ;
update_call_counter ( p , DEC_CALL_LIMIT ) ;
} else {
if ( ignore )
transmit_response ( p , " 484 Address Incomplete " , req ) ;
else
transmit_response_reliable ( p , " 484 Address Incomplete " , req , 1 ) ;
update_call_counter ( p , DEC_CALL_LIMIT ) ;
}
if ( gotdest < 0 )
transmit_response_reliable ( p , " 404 Not Found " , req , 1 ) ;
else
transmit_response_reliable ( p , " 484 Address Incomplete " , req , 1 ) ;
update_call_counter ( p , DEC_CALL_LIMIT ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
return 0 ;
} else {
/* If no extension was specified, use the s one */
if ( ast_strlen_zero ( p - > exten ) )
@ -10835,19 +10869,12 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
} else {
if ( p & & ! ast_test_flag ( p , SIP_NEEDDESTROY ) & & ! ignore ) {
if ( ! p - > jointcapability ) {
if ( ignore )
transmit_response ( p , " 488 Not Acceptable Here (codec error) " , req ) ;
else
transmit_response_reliable ( p , " 488 Not Acceptable Here (codec error) " , req , 1 ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
transmit_response_reliable ( p , " 488 Not Acceptable Here (codec error) " , req , 1 ) ;
} else {
ast_log ( LOG_NOTICE , " Unable to create/find channel \n " ) ;
if ( ignore )
transmit_response ( p , " 503 Unavailable " , req ) ;
else
transmit_response_reliable ( p , " 503 Unavailable " , req , 1 ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
transmit_response_reliable ( p , " 503 Unavailable " , req , 1 ) ;
}
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
}
}
return res ;
@ -10961,7 +10988,8 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req, int de
struct ast_channel * bridged_to ;
char iabuf [ INET_ADDRSTRLEN ] ;
if ( p - > pendinginvite & & ! ast_test_flag ( p , SIP_OUTGOING ) & & ! ignore )
/* If we have an INCOMING invite that we haven't answered, terminate that transaction */
if ( p - > pendinginvite & & ! ast_test_flag ( p , SIP_OUTGOING ) & & ! ignore & & ! p - > owner )
transmit_response_reliable ( p , " 487 Request Terminated " , & p - > initreq , 1 ) ;
copy_request ( & p - > initreq , req ) ;
@ -11202,7 +11230,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
if ( ( firststate = ast_extension_state ( NULL , p - > context , p - > exten ) ) < 0 ) {
char iabuf [ INET_ADDRSTRLEN ] ;
ast_log ( LOG_ ERROR , " Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension \n " , p - > exten , p - > context , ast_inet_ntoa ( iabuf , sizeof ( iabuf ) , p - > sa . sin_addr ) ) ;
ast_log ( LOG_ NOTIC E, " Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension \n " , p - > exten , p - > context , ast_inet_ntoa ( iabuf , sizeof ( iabuf ) , p - > sa . sin_addr ) ) ;
transmit_response ( p , " 404 Not found " , req ) ;
ast_set_flag ( p , SIP_NEEDDESTROY ) ;
return 0 ;
@ -11272,7 +11300,6 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
{
/* Called with p->lock held, as well as p->owner->lock if appropriate, keeping things
relatively static */
struct sip_request resp ;
char * cmd ;
char * cseq ;
char * useragent ;
@ -11286,9 +11313,6 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
char * e ;
int error = 0 ;
/* Clear out potential response */
memset ( & resp , 0 , sizeof ( resp ) ) ;
/* Get Method and Cseq */
cseq = get_header ( req , " Cseq " ) ;
cmd = req - > header [ 0 ] ;
@ -11303,7 +11327,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
error = 1 ;
}
if ( error ) {
if ( ! p - > initreq . header ) /* New call */
if ( ! p - > initreq . header s ) /* New call */
ast_set_flag ( p , SIP_NEEDDESTROY ) ; /* Make sure we destroy this dialog */
return - 1 ;
}
@ -11534,7 +11558,7 @@ retrylock:
goto retrylock ;
}
if ( ! lockretry ) {
ast_log ( LOG_ERROR , " We could NOT get the channel lock for %s ! \n " , p - > owner - > name ) ;
ast_log ( LOG_ERROR , " We could NOT get the channel lock for %s - Call ID %s ! \n " , p - > owner - > name , p - > callid ) ;
ast_log ( LOG_ERROR , " SIP MESSAGE JUST IGNORED: %s \n " , req . data ) ;
ast_log ( LOG_ERROR , " BAD! BAD! BAD! \n " ) ;
return 1 ;
@ -11576,7 +11600,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer)
time ( & peer - > lastmsgcheck ) ;
/* Return now if it's the same thing we told them last time */
if ( ( ( newmsgs << 8 ) | ( oldmsgs ) ) = = peer - > lastmsgssent ) {
if ( ( ( newmsgs > 0x7fff ? 0x7fff0000 : ( newmsgs < < 16 ) ) | ( oldmsgs > 0xffff ? 0xffff : oldmsgs ) ) = = peer - > lastmsgssent ) {
return 0 ;
}
@ -11585,7 +11609,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer)
ast_log ( LOG_WARNING , " Unable to build sip pvt data for MWI \n " ) ;
return - 1 ;
}
peer - > lastmsgssent = ( ( newmsgs << 8 ) | ( oldmsgs ) ) ;
peer - > lastmsgssent = ( ( newmsgs > 0x7fff ? 0x7fff0000 : ( newmsgs < < 16 ) ) | ( oldmsgs > 0xffff ? 0xffff : oldmsgs ) ) ;
if ( create_addr_from_peer ( p , peer ) ) {
/* Maybe they're not registered, etc. */
sip_destroy ( p ) ;
@ -11816,7 +11840,7 @@ static int sip_poke_peer(struct sip_peer *peer)
peer - > call = NULL ;
return 0 ;
}
if ( peer - > call > 0 ) {
if ( peer - > call ) {
if ( sipdebug )
ast_log ( LOG_NOTICE , " Still have a QUALIFY dialog active, deleting \n " ) ;
sip_destroy ( peer - > call ) ;
@ -13520,8 +13544,10 @@ static int sip_do_reload(void)
sip_destroy ( iterator - > call ) ;
}
ASTOBJ_UNLOCK ( iterator ) ;
} while ( 0 ) ) ;
ASTOBJ_CONTAINER_DESTROYALL ( & userl , sip_destroy_user ) ;
ASTOBJ_CONTAINER_DESTROYALL ( & regl , sip_registry_destroy ) ;
ASTOBJ_CONTAINER_MARKALL ( & peerl ) ;
@ -13713,13 +13739,7 @@ int unload_module()
while ( p ) {
pl = p ;
p = p - > next ;
/* Free associated memory */
ast_mutex_destroy ( & pl - > lock ) ;
if ( pl - > chanvars ) {
ast_variables_destroy ( pl - > chanvars ) ;
pl - > chanvars = NULL ;
}
free ( pl ) ;
__sip_destroy ( pl , 1 ) ;
}
iflist = NULL ;
ast_mutex_unlock ( & iflock ) ;