From bd938788e445bf202b09016d1e79a6d29a253161 Mon Sep 17 00:00:00 2001 From: bbryant Date: Mon, 12 May 2008 15:18:10 +0000 Subject: Merged revisions 115669 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r115669 | bbryant | 2008-05-12 10:17:32 -0500 (Mon, 12 May 2008) | 3 lines A small change to fix iax2 native bridging. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115672 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_iax2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 22af598bb..abdad2da6 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3759,8 +3759,11 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha struct timeval waittimer = {0, 0}, tv; /* We currently do not support native bridging if a timeoutms value has been provided */ - if (timeoutms) + if (timeoutms > 0) { return AST_BRIDGE_FAILED; + } + + timeoutms = 0; lock_both(callno0, callno1); if (!iaxs[callno0] || !iaxs[callno1]) { -- cgit v1.2.3 From 7bb91016eb89fdc19b1aaf383ec1be27eca7af5d Mon Sep 17 00:00:00 2001 From: qwell Date: Mon, 12 May 2008 16:36:24 +0000 Subject: Merged revisions 115705 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r115705 | qwell | 2008-05-12 11:35:50 -0500 (Mon, 12 May 2008) | 1 line Correctly document state interface for AddQueueMember. Discovered while looking at issue #12626. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115706 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index a4bab17ff..72236fed9 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -196,7 +196,7 @@ static char *descrip = static char *app_aqm = "AddQueueMember" ; static char *app_aqm_synopsis = "Dynamically adds queue members" ; static char *app_aqm_descrip = -" AddQueueMember(queuename[,interface[,penalty[,options[,membername]]]]):\n" +" AddQueueMember(queuename[,interface[,penalty[,options[,membername[,stateinterface]]]]]):\n" "Dynamically adds interface to an existing queue.\n" "If the interface is already in the queue it will return an error.\n" " This application sets the following channel variable upon completion:\n" @@ -4229,7 +4229,7 @@ static int aqm_exec(struct ast_channel *chan, void *data) int penalty = 0; if (ast_strlen_zero(data)) { - ast_log(LOG_WARNING, "AddQueueMember requires an argument (queuename[,[interface],[penalty][,options][,membername]])\n"); + ast_log(LOG_WARNING, "AddQueueMember requires an argument (queuename[,interface[,penalty[,options[,membername[,stateinterface]]]]])\n"); return -1; } -- cgit v1.2.3 From 5f26c4f779fae0f7b5410246ec31c265f77a6379 Mon Sep 17 00:00:00 2001 From: mmichelson Date: Mon, 12 May 2008 17:57:03 +0000 Subject: Merged revisions 115737 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r115737 | mmichelson | 2008-05-12 12:55:08 -0500 (Mon, 12 May 2008) | 15 lines Merged revisions 115735 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115735 | mmichelson | 2008-05-12 12:51:14 -0500 (Mon, 12 May 2008) | 7 lines If a thread holds no locks, do not print any information on the thread when issuing a core show locks command. This will help to de-clutter output somewhat. Russell said it would be fine to place this improvement in the 1.4 branch, so that's why it's going here too. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115738 f38db490-d61c-443f-a65b-d21fe96a405b --- main/utils.c | 78 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/main/utils.c b/main/utils.c index 0001b516c..bfd13d41c 100644 --- a/main/utils.c +++ b/main/utils.c @@ -749,46 +749,48 @@ static char *handle_show_locks(struct ast_cli_entry *e, int cmd, struct ast_cli_ pthread_mutex_lock(&lock_infos_lock.mutex); AST_LIST_TRAVERSE(&lock_infos, lock_info, entry) { int i; - ast_str_append(&str, 0, "=== Thread ID: %d (%s)\n", (int) lock_info->thread_id, - lock_info->thread_name); - pthread_mutex_lock(&lock_info->lock); - for (i = 0; str && i < lock_info->num_locks; i++) { - int j; - ast_mutex_t *lock; - - ast_str_append(&str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n", - lock_info->locks[i].pending > 0 ? "Waiting for " : - lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i, - lock_info->locks[i].file, - locktype2str(lock_info->locks[i].type), - lock_info->locks[i].line_num, - lock_info->locks[i].func, lock_info->locks[i].lock_name, - lock_info->locks[i].lock_addr, - lock_info->locks[i].times_locked); - - if (!lock_info->locks[i].pending || lock_info->locks[i].pending == -1) - continue; - - /* We only have further details for mutexes right now */ - if (lock_info->locks[i].type != AST_MUTEX) - continue; - - lock = lock_info->locks[i].lock_addr; - - ast_reentrancy_lock(lock); - for (j = 0; str && j < lock->reentrancy; j++) { - ast_str_append(&str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n", - lock->file[j], lock->lineno[j], lock->func[j]); + if (lock_info->num_locks) { + ast_str_append(&str, 0, "=== Thread ID: %d (%s)\n", (int) lock_info->thread_id, + lock_info->thread_name); + pthread_mutex_lock(&lock_info->lock); + for (i = 0; str && i < lock_info->num_locks; i++) { + int j; + ast_mutex_t *lock; + + ast_str_append(&str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n", + lock_info->locks[i].pending > 0 ? "Waiting for " : + lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i, + lock_info->locks[i].file, + locktype2str(lock_info->locks[i].type), + lock_info->locks[i].line_num, + lock_info->locks[i].func, lock_info->locks[i].lock_name, + lock_info->locks[i].lock_addr, + lock_info->locks[i].times_locked); + + if (!lock_info->locks[i].pending || lock_info->locks[i].pending == -1) + continue; + + /* We only have further details for mutexes right now */ + if (lock_info->locks[i].type != AST_MUTEX) + continue; + + lock = lock_info->locks[i].lock_addr; + + ast_reentrancy_lock(lock); + for (j = 0; str && j < lock->reentrancy; j++) { + ast_str_append(&str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n", + lock->file[j], lock->lineno[j], lock->func[j]); + } + ast_reentrancy_unlock(lock); } - ast_reentrancy_unlock(lock); + pthread_mutex_unlock(&lock_info->lock); + if (!str) + break; + ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n" + "===\n"); + if (!str) + break; } - pthread_mutex_unlock(&lock_info->lock); - if (!str) - break; - ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n" - "===\n"); - if (!str) - break; } pthread_mutex_unlock(&lock_infos_lock.mutex); -- cgit v1.2.3 -- cgit v1.2.3 From da85418be92ba0af89d3e272c42262b8bfb9218f Mon Sep 17 00:00:00 2001 From: russell Date: Tue, 13 May 2008 17:14:50 +0000 Subject: Merged revisions 115847 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r115847 | russell | 2008-05-13 12:14:22 -0500 (Tue, 13 May 2008) | 2 lines Initialize the start time in smdi_msg_wait. Somehow this code got lost in trunk. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115848 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_smdi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/res/res_smdi.c b/res/res_smdi.c index bd3170ee8..23fddada8 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -390,6 +390,8 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout, long diff = 0; void *msg; + start = ast_tvnow(); + while (diff < timeout) { struct timespec ts = { 0, }; struct timeval tv; -- cgit v1.2.3 -- cgit v1.2.3 From d3d474b2d33aef32a569d699f91cd48fceab36b7 Mon Sep 17 00:00:00 2001 From: tilghman Date: Tue, 13 May 2008 18:38:53 +0000 Subject: Merged revisions 115886 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r115886 | tilghman | 2008-05-13 13:38:11 -0500 (Tue, 13 May 2008) | 11 lines Merged revisions 115884 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115884 | tilghman | 2008-05-13 13:36:13 -0500 (Tue, 13 May 2008) | 3 lines If the socket dies (read returns 0=EOF), return immediately. (Closes issue #12637) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115887 f38db490-d61c-443f-a65b-d21fe96a405b --- main/asterisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/asterisk.c b/main/asterisk.c index 23adc0f53..ff579404a 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -2440,7 +2440,7 @@ static void ast_remotecontrol(char * data) char buf[512] = "", *curline = buf, *nextline; int not_written = 1; - if (read(ast_consock, buf, sizeof(buf) - 1) < 0) { + if (read(ast_consock, buf, sizeof(buf) - 1) <= 0) { break; } -- cgit v1.2.3 From f89785eb4792618ca7061ddf95059db55e38690b Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 13 May 2008 20:13:39 +0000 Subject: Merged revisions 115939 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r115939 | mattf | 2008-05-13 15:11:20 -0500 (Tue, 13 May 2008) | 1 line Add support for receiving calling party category ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115940 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_zap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 6b5e177f1..f474f1d80 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -702,6 +702,7 @@ static struct zt_pvt { char lspi_ident[50]; unsigned int call_ref_ident; unsigned int call_ref_pc; + unsigned char calling_party_cat; int transcap; int cic; /*!< CIC associated with channel */ unsigned int dpc; /*!< CIC's DPC */ @@ -9231,6 +9232,11 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset) /* Clear this after we set it */ p->call_ref_pc = 0; + snprintf(tmp, sizeof(tmp), "%d", p->calling_party_cat); + pbx_builtin_setvar_helper(c, "SS7_CALLING_PARTY_CATEGORY", tmp); + /* Clear this after we set it */ + p->call_ref_pc = 0; + if (!ast_strlen_zero(p->redirecting_num)) { pbx_builtin_setvar_helper(c, "SS7_REDIRECTING_NUMBER", p->redirecting_num); /* Clear this after we set it */ @@ -9527,6 +9533,7 @@ static void *ss7_linkset(void *data) ast_copy_string(p->orig_called_num, e->iam.orig_called_num, sizeof(p->orig_called_num)); ast_copy_string(p->redirecting_num, e->iam.redirecting_num, sizeof(p->redirecting_num)); ast_copy_string(p->generic_name, e->iam.generic_name, sizeof(p->generic_name)); + p->calling_party_cat = e->iam.calling_party_cat; /* Set DNID */ if (!ast_strlen_zero(e->iam.called_party_num)) -- cgit v1.2.3 From dc119bf1ee7263aa6002a7b764b38595156aee82 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 13 May 2008 20:19:58 +0000 Subject: Merged revisions 115941 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r115941 | mattf | 2008-05-13 15:18:04 -0500 (Tue, 13 May 2008) | 1 line Need to clear calling_party_cat variable after we retrieve it ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115942 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_zap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/chan_zap.c b/channels/chan_zap.c index f474f1d80..f8538e5ea 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -9235,7 +9235,7 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset) snprintf(tmp, sizeof(tmp), "%d", p->calling_party_cat); pbx_builtin_setvar_helper(c, "SS7_CALLING_PARTY_CATEGORY", tmp); /* Clear this after we set it */ - p->call_ref_pc = 0; + p->calling_party_cat = 0; if (!ast_strlen_zero(p->redirecting_num)) { pbx_builtin_setvar_helper(c, "SS7_REDIRECTING_NUMBER", p->redirecting_num); -- cgit v1.2.3 From f7b6a1bb291c6a931895776512975e3727588f1c Mon Sep 17 00:00:00 2001 From: file Date: Tue, 13 May 2008 20:30:21 +0000 Subject: Merged revisions 115945 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r115945 | file | 2008-05-13 17:29:27 -0300 (Tue, 13 May 2008) | 12 lines Merged revisions 115944 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115944 | file | 2008-05-13 17:28:23 -0300 (Tue, 13 May 2008) | 4 lines Use the right flag to open the audio in non-blocking. (closes issue #12616) Reported by: nicklewisdigiumuser ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115946 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_alsa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 3e9199fce..27c372608 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -89,7 +89,6 @@ static snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE; static snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE; #endif -/* static int block = O_NONBLOCK; */ static char indevname[50] = ALSA_INDEV; static char outdevname[50] = ALSA_OUTDEV; @@ -170,7 +169,7 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream) unsigned int rate = DESIRED_RATE; snd_pcm_uframes_t start_threshold, stop_threshold; - err = snd_pcm_open(&handle, dev, stream, O_NONBLOCK); + err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK); if (err < 0) { ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err)); return NULL; -- cgit v1.2.3 From 4ebd2414372a603b7a7dc17bc898cfe45c91388b Mon Sep 17 00:00:00 2001 From: russell Date: Tue, 13 May 2008 21:12:10 +0000 Subject: Merged revisions 116001 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r116001 | russell | 2008-05-13 16:07:59 -0500 (Tue, 13 May 2008) | 13 lines Merged revisions 115990 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115990 | russell | 2008-05-13 16:05:57 -0500 (Tue, 13 May 2008) | 5 lines Fix an issue that I noticed in autoservice while mmichelson and I were debugging a different problem. I noticed that it was theoretically possible for two threads to attempt to start the autoservice thread at the same time. This change makes the process of starting the autoservice thread, thread-safe. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@116020 f38db490-d61c-443f-a65b-d21fe96a405b --- main/autoservice.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main/autoservice.c b/main/autoservice.c index d34883389..c2550916a 100644 --- a/main/autoservice.c +++ b/main/autoservice.c @@ -195,25 +195,29 @@ int ast_autoservice_start(struct ast_channel *chan) ast_channel_unlock(chan); AST_LIST_LOCK(&aslist); - if (AST_LIST_EMPTY(&aslist)) + + if (AST_LIST_EMPTY(&aslist) && asthread != AST_PTHREADT_NULL) { ast_cond_signal(&as_cond); + } + AST_LIST_INSERT_HEAD(&aslist, as, list); - AST_LIST_UNLOCK(&aslist); if (asthread == AST_PTHREADT_NULL) { /* need start the thread */ if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) { ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n"); /* There will only be a single member in the list at this point, the one we just added. */ - AST_LIST_LOCK(&aslist); AST_LIST_REMOVE(&aslist, as, list); - AST_LIST_UNLOCK(&aslist); free(as); + asthread = AST_PTHREADT_NULL; res = -1; - } else + } else { pthread_kill(asthread, SIGURG); + } } + AST_LIST_UNLOCK(&aslist); + return res; } -- cgit v1.2.3 From a07fee7426396c1e52e406b126143b7f96b9efc8 Mon Sep 17 00:00:00 2001 From: russell Date: Tue, 13 May 2008 21:19:21 +0000 Subject: Merged revisions 116039 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r116039 | russell | 2008-05-13 16:18:55 -0500 (Tue, 13 May 2008) | 32 lines Merged revisions 116038 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r116038 | russell | 2008-05-13 16:17:23 -0500 (Tue, 13 May 2008) | 24 lines Fix a deadlock involving channel autoservice and chan_local that was debugged and fixed by mmichelson and me. We observed a system that had a bunch of threads stuck in ast_autoservice_stop(). The reason these threads were waiting around is because this function waits to ensure that the channel list in the autoservice thread gets rebuilt before the stop() function returns. However, the autoservice thread was also locked, so the autoservice channel list was never getting rebuilt. The autoservice thread was stuck waiting for the channel lock on a local channel. However, the local channel was locked by a thread that was stuck in the autoservice stop function. It turned out that the issue came down to the local_queue_frame() function in chan_local. This function assumed that one of the channels passed in as an argument was locked when called. However, that was not always the case. There were multiple cases in which this channel was not locked when the function was called. We fixed up chan_local to indicate to this function whether this channel was locked or not. The previous assumption had caused local_queue_frame() to improperly return with the channel locked, where it would then never get unlocked. (closes issue #12584) (related to issue #12603) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@116040 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_local.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/channels/chan_local.c b/channels/chan_local.c index 1795e0bb0..747e922fa 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -167,7 +167,8 @@ static struct local_pvt *local_pvt_destroy(struct local_pvt *pvt) return NULL; } -static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us) +static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, + struct ast_channel *us, int us_locked) { struct ast_channel *other = NULL; @@ -191,11 +192,13 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra /* Ensure that we have both channels locked */ while (other && ast_channel_trylock(other)) { ast_mutex_unlock(&p->lock); - if (us) + if (us && us_locked) { ast_channel_unlock(us); + } usleep(1); - if (us) + if (us && us_locked) { ast_channel_lock(us); + } ast_mutex_lock(&p->lock); other = isoutbound ? p->owner : p->chan; } @@ -224,7 +227,7 @@ static int local_answer(struct ast_channel *ast) if (isoutbound) { /* Pass along answer since somebody answered us */ struct ast_frame answer = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER }; - res = local_queue_frame(p, isoutbound, &answer, ast); + res = local_queue_frame(p, isoutbound, &answer, ast, 1); } else ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n"); if (!res) @@ -313,7 +316,7 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f) if (f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) check_bridge(p, isoutbound); if (!ast_test_flag(p, LOCAL_ALREADY_MASQED)) - res = local_queue_frame(p, isoutbound, f, ast); + res = local_queue_frame(p, isoutbound, f, ast, 1); else { ast_debug(1, "Not posting to queue since already masked on '%s'\n", ast->name); res = 0; @@ -367,7 +370,7 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da f.subclass = condition; f.data = (void*)data; f.datalen = datalen; - if (!(res = local_queue_frame(p, isoutbound, &f, ast))) + if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) ast_mutex_unlock(&p->lock); } @@ -387,7 +390,7 @@ static int local_digit_begin(struct ast_channel *ast, char digit) ast_mutex_lock(&p->lock); isoutbound = IS_OUTBOUND(ast, p); f.subclass = digit; - if (!(res = local_queue_frame(p, isoutbound, &f, ast))) + if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0))) ast_mutex_unlock(&p->lock); return res; @@ -407,7 +410,7 @@ static int local_digit_end(struct ast_channel *ast, char digit, unsigned int dur isoutbound = IS_OUTBOUND(ast, p); f.subclass = digit; f.len = duration; - if (!(res = local_queue_frame(p, isoutbound, &f, ast))) + if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0))) ast_mutex_unlock(&p->lock); return res; @@ -427,7 +430,7 @@ static int local_sendtext(struct ast_channel *ast, const char *text) isoutbound = IS_OUTBOUND(ast, p); f.data = (char *) text; f.datalen = strlen(text) + 1; - if (!(res = local_queue_frame(p, isoutbound, &f, ast))) + if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0))) ast_mutex_unlock(&p->lock); return res; } @@ -447,7 +450,7 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat f.subclass = subclass; f.data = (char *)data; f.datalen = datalen; - if (!(res = local_queue_frame(p, isoutbound, &f, ast))) + if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0))) ast_mutex_unlock(&p->lock); return res; } @@ -572,7 +575,7 @@ static int local_hangup(struct ast_channel *ast) /* Need to actually hangup since there is no PBX */ ochan = p->chan; else - res = local_queue_frame(p, isoutbound, &f, NULL); + res = local_queue_frame(p, isoutbound, &f, NULL, 1); if (!res) ast_mutex_unlock(&p->lock); if (ochan) -- cgit v1.2.3 From e8bc12b40b86c5b2049f1bf97fe51bfa9f243d35 Mon Sep 17 00:00:00 2001 From: mmichelson Date: Tue, 13 May 2008 23:58:34 +0000 Subject: Merged revisions 116089 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r116089 | mmichelson | 2008-05-13 18:54:01 -0500 (Tue, 13 May 2008) | 20 lines Merged revisions 116088 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r116088 | mmichelson | 2008-05-13 18:47:49 -0500 (Tue, 13 May 2008) | 12 lines A change to the way channel locks are handled when DEBUG_CHANNEL_LOCKS is defined. After debugging a deadlock, it was noticed that when DEBUG_CHANNEL_LOCKS is enabled in menuselect, the actual origin of channel locks is obscured by the fact that all channel locks appear to happen in the function ast_channel_lock(). This code change redefines ast_channel_lock to be a macro which maps to __ast_channel_lock(), which then relays the proper file name, line number, and function name information to the core lock functions so that this information will be displayed in the case that there is some sort of locking error or core show locks is issued. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@116096 f38db490-d61c-443f-a65b-d21fe96a405b --- include/asterisk/lock.h | 9 ++++++--- main/channel.c | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 36c25a87d..edc285a5f 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -1205,18 +1205,21 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), #define ast_channel_trylock(x) ast_mutex_trylock(&x->lock_dont_use) #else +#define ast_channel_lock(a) __ast_channel_lock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_lock(struct ast_channel *chan); +int __ast_channel_lock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_unlock(a) __ast_channel_unlock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Unlock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_unlock(struct ast_channel *chan); +int __ast_channel_unlock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_trylock(a) __ast_channel_trylock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_trylock(struct ast_channel *chan); +int __ast_channel_trylock(struct ast_channel *chan, const char *file, int lineno, const char *func); #endif #endif /* _ASTERISK_LOCK_H */ diff --git a/main/channel.c b/main/channel.c index 02c7451c1..abc7544f8 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4936,7 +4936,7 @@ const char *channelreloadreason2txt(enum channelreloadreason reason) /*! \brief Unlock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_unlock(struct ast_channel *chan) +int __ast_channel_unlock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { int res = 0; ast_debug(3, "::::==== Unlocking AST channel %s\n", chan->name); @@ -4945,8 +4945,11 @@ int ast_channel_unlock(struct ast_channel *chan) ast_debug(1, "::::==== Unlocking non-existing channel \n"); return 0; } - +#ifdef DEBUG_THREADS + res = __ast_pthread_mutex_unlock(filename, lineno, func, "(channel lock)", &chan->lock_dont_use); +#else res = ast_mutex_unlock(&chan->lock_dont_use); +#endif if (option_debug > 2) { #ifdef DEBUG_THREADS @@ -4970,13 +4973,17 @@ int ast_channel_unlock(struct ast_channel *chan) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_lock(struct ast_channel *chan) +int __ast_channel_lock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { int res; ast_debug(4, "====:::: Locking AST channel %s\n", chan->name); +#ifdef DEBUG_THREADS + res = __ast_pthread_mutex_lock(filename, lineno, func, "(channel lock)", &chan->lock_dont_use); +#else res = ast_mutex_lock(&chan->lock_dont_use); +#endif if (option_debug > 3) { #ifdef DEBUG_THREADS @@ -4999,13 +5006,16 @@ int ast_channel_lock(struct ast_channel *chan) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_trylock(struct ast_channel *chan) +int __ast_channel_trylock(struct ast_channel *chan, const char *filename, int lineno, const char *func) { int res; ast_debug(3, "====:::: Trying to lock AST channel %s\n", chan->name); - +#ifdef DEBUG_THREADS + res = __ast_pthread_mutex_trylock(filename, lineno, func, "(channel lock)", &chan->lock_dont_use); +#else res = ast_mutex_trylock(&chan->lock_dont_use); +#endif if (option_debug > 2) { #ifdef DEBUG_THREADS -- cgit v1.2.3 -- cgit v1.2.3 From 192468bae9997f24dd33ec6309f9d56f8de86fc0 Mon Sep 17 00:00:00 2001 From: oej Date: Wed, 14 May 2008 13:13:18 +0000 Subject: Merged revisions 116234 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ................ r116234 | oej | 2008-05-14 15:05:15 +0200 (Ons, 14 Maj 2008) | 11 lines Merged revisions 116230 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r116230 | oej | 2008-05-14 14:51:06 +0200 (Ons, 14 Maj 2008) | 3 lines Accept text messages even with Content-Type: text/plain;charset=Södermanländska ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@116236 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index ebbafbeb6..e4f95b7be 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11575,8 +11575,8 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req) struct ast_frame f; const char *content_type = get_header(req, "Content-Type"); - if (strcmp(content_type, "text/plain")) { /* No text/plain attachment */ - transmit_response(p, "415 Unsupported Media Type", req); + if (strncmp(content_type, "text/plain", strlen("text/plain"))) { /* No text/plain attachment */ + transmit_response(p, "415 Unsupported Media Type", req); /* Good enough, or? */ if (!p->owner) sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); return; -- cgit v1.2.3