From ce58e5862d32dcb5964716f8244ded00898f3d42 Mon Sep 17 00:00:00 2001 From: Matteo Brancaleoni <mbrancaleoni@espia.it> Date: Tue, 4 Mar 2003 06:00:19 +0000 Subject: [PATCH] Tue Mar 4 07:00:01 CET 2003 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@631 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx.c | 20 +++++++++----------- res/res_musiconhold.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pbx.c b/pbx.c index 0f787513cd..9e9a3ecaf8 100755 --- a/pbx.c +++ b/pbx.c @@ -766,7 +766,6 @@ static void pbx_substitute_variables_helper(struct ast_channel *c,char *cp1,char *cp2='\0'; do { char *start,*start2; - if (!(*wherearewe)) break; if ((tmp=strstr(wherearewe,"${"))) { variables++; length=(int)(tmp-wherearewe); @@ -818,16 +817,15 @@ static void pbx_substitute_variables_helper(struct ast_channel *c,char *cp1,char cp1=cp2; } - - pbx_substitute_variables_temp(c,cp1,&cp4); - - if (cp4) { - /* reset output variable so we could store the result */ - *cp2='\0'; - length=strlen(cp4); - strncat(cp2,cp4,length); - } else { - if (count) cp2[0]='\0'; + if (count) { + pbx_substitute_variables_temp(c,cp1,&cp4); + if (cp4) { + /* reset output variable so we could store the result */ + *cp2='\0'; + length=strlen(cp4); + strncat(cp2,cp4,length); + } else + cp2[0]='\0'; } break; } diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 1270471863..0d540aebd7 100755 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -531,11 +531,27 @@ static void load_moh_classes(void) } } +void ast_moh_destroy(void) +{ + struct mohclass *moh; + ast_pthread_mutex_lock(&moh_lock); + moh = mohclasses; + while(moh) { + if (moh->pid) { + kill(moh->pid, SIGKILL); + moh->pid = 0; + } + moh = moh->next; + } + ast_pthread_mutex_unlock(&moh_lock); +} + int load_module(void) { int res; load_moh_classes(); res = ast_register_application(app0, moh0_exec, synopsis0, descrip0); + atexit(ast_moh_destroy); if (!res) res = ast_register_application(app1, moh1_exec, synopsis1, descrip1); if (!res) -- GitLab