--- res_parking.c 2003-11-29 11:26:04.000000000 -0800 +++ res_parking.new 2003-11-29 11:25:38.000000000 -0800 @@ -87,6 +87,10 @@ static pthread_t parking_thread; +int is_park_exten(char *data); + +int exists_parkedcall(struct ast_channel *chan, char *data); + STANDARD_LOCAL_USER; LOCAL_USER_DECL; @@ -101,6 +105,39 @@ return pickup_ext; } +int is_park_exten(char *data) +{ + int park; + park = atoi((char *)data); + if ( (park < parking_start) || (park > parking_stop) ) + return -1; + else + return 0; +} + +int exists_parkedcall(struct ast_channel *chan, char *data) +{ + struct parkeduser *cur; + int park; + int res = -1; + if (!data) { + ast_log(LOG_WARNING, "exists_parkedcall requires an argument (extension number)\n"); + return -1; + } + park = atoi((char *)data); + ast_mutex_lock(&parking_lock); + cur=parkinglot; + while(cur) { + if (cur->parkingnum == park) { + res = 0; + break; + } + + cur = cur->next; + } + ast_mutex_unlock(&parking_lock); + return res; +} int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout) { /* We put the user in the parking list, then wake up the parking thread to be sure it looks @@ -345,7 +382,9 @@ ast_log(LOG_WARNING, "Unable to park call %s\n", transferee->name); } /* XXX Maybe we should have another message here instead of invalid extension XXX */ - } else if (ast_exists_extension(transferee, transferer_real_context, newext, 1, transferer->callerid)) { + } else if ( ( ast_exists_extension(transferee, transferer_real_context, newext, 1, transferer->callerid) && (is_park_exten(newext) ==-1) ) || + ( exists_parkedcall(chan,newext)==0 ) ) + { ast_moh_stop(transferee); res=ast_autoservice_stop(transferee); if (!transferee->pbx) { @@ -602,7 +641,6 @@ static struct ast_cli_entry showparked = { { "show", "parkedcalls", NULL }, handle_parkedcalls, "Lists parked calls", showparked_help }; - int load_module(void) { int res;