[asterisk-dev] app_dial.c / stream calls help required

Tony Howat arhowat at hotmail.com
Wed Aug 16 05:06:19 MST 2006


Hi,

I'm trying to implement a requirement that we have here to play a sample to 
a user whilst we are dialling an extension - rather like music on hold but 
starting a new sample for each dial so we can play instructions to the user 
as the other end is ringing.

I've done the simple additions to the Dial command flags, and added a 
dialsample_name and dialsample_stream to ast_channel. I'm starting with some 
test code to get some/any sample played as we start the dial. As such I've 
added code to dial_exec_full at the start of the if (outgoing) condition :

if (outgoing) {
  ast_log(LOG_NOTICE, "%i Attempting to start dial sample 
%s\n",__LINE__,chan->dialsample_name);
  
chan->dialsample_stream=ast_openstream(chan,chan->dialsample_name,chan->language);
  if(chan->dialsample_stream)
  {
    ast_log(LOG_NOTICE, "%i Attempting to start dial sample 
%s\n",__LINE__,opt_args[OPT_ARG_DIAL_SAMPLE]);
    if(!ast_applystream(chan,chan->dialsample_stream))
      ast_playstream(chan->dialsample_stream);
  }

The results are :

Aug 16 12:40:29 NOTICE[17583]: app_dial.c:1212 dial_exec_full: 1212 
Attempting to start dial sample demo-thanks
Aug 16 12:40:29 NOTICE[17583]: app_dial.c:1216 dial_exec_full: 1216 
Attempting to start dial sample demo-thanks
    -- Call accepted by 10.1.230.195 (format gsm)
    -- Format for call is gsm
Aug 16 12:40:29 WARNING[17583]: chan_zap.c:4757 zt_write: Cannot handle 
frames in 2 format
Aug 16 12:40:29 WARNING[17583]: file.c:587 ast_readaudio_callback: Failed to 
write frame
    -- Hungup 'IAX2/ivroutdial-2'
  == Spawn extension (demo, 12307841437143, 1) exited non-zero on 'Zap/2-1'
       > cdr_odbc: Query Successful!
    -- Hungup 'Zap/2-1'
rh4-astinvp-1*CLI> *** glibc detected *** double free or corruption (!prev): 
0xb7809ab0 ***

The sample is one of standard gsms.

I suspect that either I'm calling the stream stuff entirely wrong, or 
attempting to apply it to a channel which is too low level to cope with GSM, 
or perhaps the wrong channel entirely.

Could someone provide some assistance here? I'm working on 1.2.9.1 but will 
port and submit any improvements to the trunk.

--
Tony





More information about the asterisk-dev mailing list