From: <do...@us...> - 2007-12-04 13:24:08
|
Revision: 1298 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1298&view=rev Author: dohpaz Date: 2007-12-04 05:24:13 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Use consistant registration timeout. Schedule registration refresh 2 seconds before expiration to better allow for packet retry. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-04 05:15:51 UTC (rev 1297) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-04 13:24:13 UTC (rev 1298) @@ -80,6 +80,8 @@ struct iaxc_registration *next; }; +static int registration_timeout = 60; + static int next_registration_id = 0; static struct iaxc_registration *registrations = NULL; @@ -763,7 +765,7 @@ iaxci_usermsg(IAXC_ERROR, "Can't make new registration session"); return; } - iax_register(cur->session, cur->host, cur->user, cur->pass, 60); + iax_register(cur->session, cur->host, cur->user, cur->pass, registration_timeout); cur->last = now; } } @@ -1264,14 +1266,14 @@ } gettimeofday(&newreg->last,NULL); - newreg->refresh = 60*1000*1000; /* 60 seconds, in usecs */ + newreg->refresh = (registration_timeout - 2) *1000*1000; /* 2 seconds before registration timeout, in usecs */ strncpy(newreg->host, host, 256); strncpy(newreg->user, user, 256); strncpy(newreg->pass, pass, 256); - /* send out the initial registration timeout 300 seconds */ - iax_register(newreg->session, host, user, pass, 300); + /* send out the initial registration with registration_timeout seconds */ + iax_register(newreg->session, host, user, pass, registration_timeout); /* add it to the list; */ newreg->id = ++next_registration_id; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2007-12-06 13:58:28
|
Revision: 1304 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1304&view=rev Author: dohpaz Date: 2007-12-06 05:58:28 -0800 (Thu, 06 Dec 2007) Log Message: ----------- Start register refresh up to 3 seconds before expiration, allow time for resend. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-06 06:10:21 UTC (rev 1303) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-12-06 13:58:28 UTC (rev 1304) @@ -749,9 +749,9 @@ for ( cur = registrations; cur != NULL; cur = cur->next ) { - // If there is less than one second before the registration is about + // If there is less than three seconds before the registration is about // to expire, renew it. - if ( iaxci_usecdiff(&now, &cur->last) > (cur->refresh - 1) * 1000 *1000 ) + if ( iaxci_usecdiff(&now, &cur->last) > (cur->refresh - 3) * 1000 *1000 ) { if ( cur->session != NULL ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-05-05 05:07:03
|
Revision: 1429 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1429&view=rev Author: dohpaz Date: 2008-05-04 22:07:10 -0700 (Sun, 04 May 2008) Log Message: ----------- Additional prophylactic code to prevent certain problems. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-05-04 15:33:56 UTC (rev 1428) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-05-05 05:07:10 UTC (rev 1429) @@ -1483,7 +1483,7 @@ EXPORT void iaxc_setup_call_transfer(int sourceCallNo, int targetCallNo) { - if ( sourceCallNo < 0 || targetCallNo < 0 || + if ( ( sourceCallNo < 0 ) || ( targetCallNo < 0 ) || !(calls[sourceCallNo].state & IAXC_CALL_STATE_ACTIVE) || !(calls[targetCallNo].state & IAXC_CALL_STATE_ACTIVE) ) return; @@ -1491,12 +1491,15 @@ iax_setup_transfer(calls[sourceCallNo].session, calls[targetCallNo].session); } +/* + iaxc_dump_one_call dumps \a callNo. Expects the routine calling it to have + obtained the iaxc lock. + */ static void iaxc_dump_one_call(int callNo) { - if ( callNo < 0 ) + if ( ( callNo < 0 ) || ( callNo >= max_calls ) || + ( calls[callNo].state == IAXC_CALL_STATE_FREE ) ) return; - if ( calls[callNo].state == IAXC_CALL_STATE_FREE ) - return; iax_hangup(calls[callNo].session,"Dumped Call"); iaxci_usermsg(IAXC_STATUS, "Hanging up call %d", callNo); @@ -1515,12 +1518,9 @@ EXPORT void iaxc_dump_call_number( int callNo ) { - if ( ( callNo >= 0 ) && ( callNo < max_calls ) ) - { - get_iaxc_lock(); - iaxc_dump_one_call(callNo); - put_iaxc_lock(); - } + get_iaxc_lock(); + iaxc_dump_one_call(callNo); + put_iaxc_lock(); } EXPORT void iaxc_dump_call(void) @@ -1543,13 +1543,14 @@ EXPORT void iaxc_reject_call_number( int callNo ) { - if ( ( callNo >= 0 ) && ( callNo < max_calls ) ) - { - get_iaxc_lock(); - iax_reject(calls[callNo].session, "Call rejected manually."); - iaxc_clear_call(callNo); - put_iaxc_lock(); - } + if ( ( callNo < 0 ) || ( callNo >= max_calls ) || + ( calls[callNo].state == IAXC_CALL_STATE_FREE ) ) + return; + + get_iaxc_lock(); + iax_reject(calls[callNo].session, "Call rejected manually."); + iaxc_clear_call(callNo); + put_iaxc_lock(); } EXPORT void iaxc_send_dtmf(char digit) @@ -1567,21 +1568,18 @@ { if ( selected_call >= 0 ) { - get_iaxc_lock(); - if ( calls[selected_call].state & IAXC_CALL_STATE_ACTIVE ) - iax_send_text(calls[selected_call].session, text); - put_iaxc_lock(); + iaxc_send_text_call(selected_call, text); } } EXPORT void iaxc_send_text_call(int callNo, const char * text) { - if ( callNo < 0 || !(calls[callNo].state & IAXC_CALL_STATE_ACTIVE) ) + if ( ( callNo < 0 ) || ( callNo >= max_calls ) || + ( !(calls[callNo].state & IAXC_CALL_STATE_ACTIVE) ) ) return; get_iaxc_lock(); - if ( calls[callNo].state & IAXC_CALL_STATE_ACTIVE ) - iax_send_text(calls[callNo].session, text); + iax_send_text(calls[callNo].session, text); put_iaxc_lock(); } @@ -1942,16 +1940,30 @@ EXPORT int iaxc_quelch(int callNo, int MOH) { - struct iax_session *session = calls[callNo].session; - if ( !session ) + int ret; + + if ( ( callNo < 0 ) || ( callNo >= max_calls ) || + !( calls[callNo].state & IAXC_CALL_STATE_ACTIVE ) ) return -1; - return iax_quelch_moh(session, MOH); + get_iaxc_lock(); + ret = iax_quelch_moh(calls[callNo].session, MOH); + put_iaxc_lock(); + return ret; } -EXPORT int iaxc_unquelch(int call) +EXPORT int iaxc_unquelch(int callNo) { - return iax_unquelch(calls[call].session); + int ret; + + if ( ( callNo < 0 ) || ( callNo >= max_calls ) || + !( calls[callNo].state & IAXC_CALL_STATE_ACTIVE ) ) + return -1; + + get_iaxc_lock(); + ret = iax_unquelch(calls[callNo].session); + put_iaxc_lock(); + return ret; } EXPORT int iaxc_mic_boost_get( void ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-05-19 15:00:30
|
Revision: 1431 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1431&view=rev Author: sbalea Date: 2008-05-19 08:00:26 -0700 (Mon, 19 May 2008) Log Message: ----------- Instrument code in service_audio() in an attempt to spot an elusive crash Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-05-08 14:10:11 UTC (rev 1430) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-05-19 15:00:26 UTC (rev 1431) @@ -863,6 +863,16 @@ int cmin; audio_driver.start(&audio_driver); + + /* check and report if pointers are not good here */ + if ( !((unsigned int)call & 0xffffff00) ) + fprintf(stderr, "*** INVALID POINTER call = 0x%x ***\n", call); + + if ( !((unsigned int)call->encoder & 0xffffff00) ) + fprintf(stderr, "*** INVALID POINTER call->encoder = 0x%x ***\n", call->encoder); + + if ( !call->state ) + fprintf(stderr, "*** INVALID CALL STATE (0) ***\n"); /* use codec minimum if higher */ cmin = want_send_audio && call->encoder ? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2008-06-11 22:25:18
|
Revision: 1434 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1434&view=rev Author: dohpaz Date: 2008-06-11 15:25:26 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Add some additional protection on shutdown by making sure to set max_calls to 0. Also initialize max_calls to 0, and calls to NULL to allow condom code to work. Modified Paths: -------------- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-06-04 14:03:56 UTC (rev 1433) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2008-06-11 22:25:26 UTC (rev 1434) @@ -108,8 +108,8 @@ int iaxci_audio_output_mode = 0; // Normal int selected_call; // XXX to be protected by mutex? -struct iaxc_call* calls; -int max_calls; // number of calls for this library session +struct iaxc_call* calls = NULL; +int max_calls = 0; // number of calls for this library session static void service_network(); static int service_audio(); @@ -691,7 +691,7 @@ /* destroy enocders and decoders for all existing calls */ if ( calls ) { - int i; + int i; for ( i=0 ; i<max_calls ; i++ ) { if ( calls[i].encoder ) @@ -702,17 +702,23 @@ calls[i].vencoder->destroy(calls[i].vencoder); if ( calls[i].vdecoder ) calls[i].vdecoder->destroy(calls[i].vdecoder); - } + } + + /* Since we're de-initialized the maximum number of calls is 0, + this lets the calls size checks handle + array validity for us. ;-) + */ + max_calls = 0; + free(calls); calls = NULL; } + put_iaxc_lock(); #ifdef WIN32 closesocket(iax_get_fd()); //fd: #endif - free(calls); - MUTEXDESTROY(&event_queue_lock); MUTEXDESTROY(&iaxc_lock); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |