? app_dial_d.diff.txt Index: apps/app_dial.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v retrieving revision 1.144 diff -u -r1.144 app_dial.c --- apps/app_dial.c 1 Apr 2005 17:00:50 -0000 1.144 +++ apps/app_dial.c 9 Apr 2005 02:59:48 -0000 @@ -92,8 +92,9 @@ " 'G(context^exten^pri)' -- If the call is answered transfer both parties to the specified exten.\n" " 'A(x)' -- play an announcement to the called party, using x as file\n" " 'S(x)' -- hangup the call after x seconds AFTER called party picked up\n" -" 'D([digits])' -- Send DTMF digit string *after* called party has answered\n" -" but before the bridge. (w=500ms sec pause)\n" +" 'D([called][:calling])' -- Send DTMF strings *after* called party has answered, but before the\n" +" call gets bridged. The 'called' DTMF string is sent to the called party, and the\n" +" 'calling' DTMF string is sent to the calling party. Both parameters can be used alone.\n" " 'L(x[:y][:z])' -- Limit the call to 'x' ms warning when 'y' ms are left\n" " repeated every 'z' ms) Only 'x' is required, 'y' and 'z' are optional.\n" " The following special variables are optional:\n" @@ -627,6 +628,8 @@ char limitdata[256]; char *sdtmfptr; char sdtmfdata[256] = ""; + char dtmfcalled[256] = ""; + char dtmfcalling[256] = ""; char *stack,*var; char *mac = NULL, *macroname = NULL; char status[256]=""; @@ -694,7 +697,7 @@ ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %i seconds.\n",calldurationlimit); } - /* DTMF SCRIPT*/ + /* Extract DTMF strings to send upon successfull connect */ if ((sdtmfptr = strstr(transfer, "D("))) { strncpy(sdtmfdata, sdtmfptr + 2, sizeof(sdtmfdata) - 1); /* Overwrite with X's what was the sdtmf info */ @@ -708,8 +711,14 @@ *sdtmfptr = '\0'; else ast_log(LOG_WARNING, "D( Data lacking trailing ')'\n"); + var=stack=sdtmfdata; + var = strsep(&stack, ":"); + if (var) { + strcpy(dtmfcalled,var); + if (stack) { strcpy(dtmfcalling,stack); } + } } - + /* XXX LIMIT SUPPORT */ if ((limitptr = strstr(transfer, "L("))) { strncpy(limitdata, limitptr + 2, sizeof(limitdata) - 1); @@ -1255,8 +1264,16 @@ time(&now); chan->whentohangup = now + calldurationlimit; } - if (!ast_strlen_zero(sdtmfdata)) - res = ast_dtmf_stream(peer,chan,sdtmfdata,250); + if (!ast_strlen_zero(dtmfcalled)) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the called party.\n",dtmfcalled); + res = ast_dtmf_stream(peer,chan,dtmfcalled,250); + } + if (!ast_strlen_zero(dtmfcalling)) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the calling party.\n",dtmfcalling); + res = ast_dtmf_stream(chan,peer,dtmfcalling,250); + } } if (!res) {