[Home]

Summary:ASTERISK-02668: [Patch] add a flag to app_dial to wait until someone has answer and confirm
Reporter:mochouinard (mochouinard)Labels:
Date Opened:2004-10-23 23:26:06Date Closed:2011-06-07 14:04:58
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_dial
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_dial.c-confirm_rev3.txt
Description:This patch add 2 flag, c and v(x). c activate the wait and confirm, and v is a prompt to playback when someone has answered (Ex. Press 9 to accept the call, or hangup)


****** ADDITIONAL INFORMATION ******

ex :
exten => s,1,Dial(SIP/remotepeer&Zap/1/180012345678&IAX2/iaxtel/whatever,,cv(/tmp/recording here))
Disclamed
Comments:By: mochouinard (mochouinard) 2004-10-23 23:27:26

This app is preliminary, the basic work, but there is alot of work to do. But please let me know if your interested by this, and if you can help me out, that be great. My IRC nick is Moc

By: Mark Spencer (markster) 2004-10-24 00:04:20

Why not just make another option to the existing dial command?

By: mochouinard (mochouinard) 2004-10-24 00:18:28

it didnt sound that simple. I found it easier to do it in a different app, and that way, Im sure im aint broking app_dial..

By: cmslaght (cmslaght) 2004-10-24 10:32:27

I use this sequence:
exten => 1,2,Playback(pleaserecordyourname)
exten => 1,3,Record(${UNIQUEID}:gsm|2)
exten => 1,4,Dial(Zap/g2c/${CHRIS-CELL},20,rA(${UNIQUEID}))

where the 'c' portion of the dial zap line waits for the callee to press '#' before bridging the call.  What I really want, is the the ability to press '#' to acknowledge the call, then get the Announcement and then hit '#' again to bridge the call if I want to accept it.

By: mochouinard (mochouinard) 2004-10-24 19:03:59

cmslaght , the c flag on the zap interface only work with Zap interface. This one work with all of them, second for the dual # key thing, well the code can be changed easily to do what you want

By: cmslaght (cmslaght) 2004-10-24 20:38:47

If you can add the announce option A(filename) and the second '#' I will install and start testing.

By: mochouinard (mochouinard) 2004-10-24 21:31:32

I had in mind to add a A(flag) but not adding a second #. The channel will get answered, then recording will be played, asking to press # to take the call.

I dont see the need of a second # request. Are you sure ? Are you Really Really Sure ?..???

By: cmslaght (cmslaght) 2004-10-24 21:47:40

How are you going to determine when to start playing the announcment? The only reason why I suggested using a '#' before and after the announcement is to start the announcement and then to accept the caller.  Right now, the 'c' flag accepts the call and if the option A is present, it plays it but by that time you have already accepted the call.  

Only having one '#' seems simplier!

By: mochouinard (mochouinard) 2004-10-24 22:41:55

The announcement will be played once the call has being answered from the remote user.

But I would understand that this only work using call progress (via a PRI or a VoIP provider that do call progress(all of them does).

If your using a analog Zap card, I could see the problem.  I could make the announcement play in loop until the timeout is reach if that is your problem ?  But my guess is a VoIP will be perfect for you, and your being using the x100p because there are no other options.

By: cmslaght (cmslaght) 2004-10-24 22:50:46

I have a PRI but started out with X100's so I knew that was a problem.  I don't see any reason why looping would cause any problems.  It would make it work for anyone.

By: mochouinard (mochouinard) 2004-10-25 09:11:23

Great, I'll push a new version this week

By: mochouinard (mochouinard) 2004-10-25 23:36:36

Ok this new versions Ive added the A() flag, and fixed hangup problems (need cleanup as usual)
Ok the A() doesn't loop, but play when answered 1 time.
Also the timeout option is ignores at the moment
So here we go
exten => dialconfirm(SIP/6000&SIP/6001|20|A(prompt))

Now I wonder if I should have 2 timeout, 1 RING timeout, and 1 wait for pressing # timeout, what you guys think ?

By: cmslaght (cmslaght) 2004-10-27 12:56:54

Call me stupid.. How do I install this?

By: mochouinard (mochouinard) 2004-10-27 13:46:49

the way I do it, is put the .c file in the usr/src/asterisk/apps folder
and modify the Makefile from the same folder to add app_dialconfirmanswer.so on the APPS=...
And make install from usr/src/asterisk (not from apps) should do it

By: cmslaght (cmslaght) 2004-10-28 21:02:57

compiled v2.  Got the following stuff when restarting:
[app_dialconfirmanswer.so]Oct 28 22:12:02 WARNING[16384]: loader.c:299 ast_load_resource: /usr/lib/asterisk/modules/app_dialconfirmanswer.so: undefined symbol: __use_ast_pthread_create_instead__
Oct 28 22:12:02 WARNING[16384]: loader.c:480 load_modules: Loading module app_dialconfirmanswer.so failed!
discovery*CLI>

By: cmslaght (cmslaght) 2004-10-28 21:40:57

Updated to currect CVS and now app wont compile correctly.

By: mochouinard (mochouinard) 2004-10-29 23:10:37

Here we go, I fixed all the warning, and fixed a few stuff. Let me know if it work on your side.

By: Clod Patry (junky) 2004-11-01 12:47:58.000-0600

goto out;
Can't you change this for a function?
goto is really bad in general.
I know in some circomstances, ya must use it, but i don't think it's really needed in your application.

Plus im not sure to understand this:
       if (!data) {
               ast_log(LOG_WARNING, "DialConfirm requires an argument (filename)\n");
               return -1;
       }
filename??? maybe based on template?

Maybe suggestion: why not leaving the choice of the dtmf to confirm the dial?

edited on: 11-01-04 12:48

By: mochouinard (mochouinard) 2004-11-01 16:32:39.000-0600

the new app is far from done junky ;) timeout aint made yet, no documentation also is done.

For the goto stuff, I never used goto until I saw kram and others using it in Asterisk, So Im just trying to be consistent with the others apps.

and for the selection of the DTMF, maybe we could set a flag. Like maybe people will want to have to enter a password. so I'll check on that too.

Except the code stuff, does it work ? ;)

By: mochouinard (mochouinard) 2004-11-07 02:29:43.000-0600

Ok I uploaded a new version. It has some documentation done, also started the timeout option(it currently a universal timeout, if it 10 second, then someone has to answer and press # WITHIN the 10 second, it could be frustrating, Im gonna add a Grace Timeout on answer as option))
Also fixed that if no one answer, it continue the dial plan instead than just hanging up.

By: mochouinard (mochouinard) 2004-11-07 08:57:33.000-0600

I have added the G(x) flag, that is a timeout grace period after remote have answered the call. So if you have specified a timeout already plus this, your original timeout wont be absolute, when answered, the timeout will be reset to the  one set into G(x).  This allow that if you set a timeout of 15 second, and I answer after 14 second, it only leave me 1 second to press # (and hear the prompt if one is set). So you can make it timeout after another 10 second if you wish instead. I saw an error, so I'll upload _v6

By: Mark Spencer (markster) 2004-11-16 23:30:17.000-0600

Where do you think this is in terms of being merged?

By: mochouinard (mochouinard) 2004-11-17 00:02:31.000-0600

Im using it over here just fine.  I hope others have tested it.
Only problem is when the call is being bridged, there is warning(but everything still work), I donno how to handle them. If anyone can check it please

By: Brian West (bkw918) 2004-11-18 19:10:42.000-0600

deprecated by 2905

By: mochouinard (mochouinard) 2004-11-19 01:14:53.000-0600

This patch aint  deprecated by 2905. This page is made so if you dial multiple channel device, that it will wait until one answer and press #.  This is made in the event that you wish to call all your personal numbers, but dont wish that if your voicemail answer on the first ring, that all the others called number stop ringing so you miss called.

Please, next time, ask if the other patch fill the need of a current bugs repport before closing this way.  Thanks

By: Anthony Minessale (anthm) 2004-11-22 17:28:33.000-0600

Seems like Dial() just needs 'K(file:X)' flag (e.g. K(beep:#)) where file is played to all the candidates and dtmf X is requied before allowing the bridge.

app_dial already supports multi-device dial all it needs is the small change to the streaming of the file dtmf confirmation as a prerequsite to be considered the winning channel whever the cX flag is present (of corse 1 thread streaming files to 10 chans seems tricky but necessity is the mother of invention)

As you can see in this thread you are already starting to need features from app_dial and are porting them 1 by one so you may as well hack app_dial or
you will just end up with an entire clone of app_dial anyway.

I know you have a fear to break app_dial but your new app not working right
is no better than if you break app_dial so you've nothing to lose as long as you get it right in the end =D (1 monster swiss army app is better than 2)

By: mochouinard (mochouinard) 2004-11-22 18:26:22.000-0600

Agreed, that is why I base my application on app_dial, to help me out when I'll port it to app_dial. Since I removed the threads, I'll beable to do it, I've look at it, and I guess in 2 hours it could be done. I just need to put my code where the ast_request is called so I manage myself all the call separetly like it kind of doing, then continue once an app have apply all those steps. I'll try maybe tonight to look at it again.  Anyway it sound easy rightnow in my mind, but when I'll look at the appdial again, I'll see if im ready to hack it up.

By: Clod Patry (junky) 2004-11-22 22:29:47.000-0600

i've installed ur app.
saw this in the show applications:
[...]
                 Dial: Place a call and connect to the current channel
          DialConfirm:   DialConfirm(Technology/resource[&Technology2/resource2...][|timeout][|options]):
Requests one or more channels and places specified outgoing calls on them.
and wait for any channel to answer AND press the confirmation code.
Default Confirmation code is #, and hangup is *
 This application returns -1 if the originating channel hangs up, or if the
call is bridged and either of the parties in the bridge terminate the call.
The option string may contain zero or more of the following characters:
     'A(x)' -- play an announcement to the called party, using x as file
     'G(x)' -- add a x number of second if a peer have answered the call before being hangup


         DigitTimeout: Set maximum timeout between digits
[...]
the show applications use the synopsis, so i've just put your synopsis into the desc (which is used in the show application dialconfirm.

with the patch, the show applications looks like:
[...]
              DeadAGI: Executes AGI on a hungup channel
                 Dial: Place a call and connect to the current channel
          DialConfirm: Dial with allowing a confirmation
         DigitTimeout: Set maximum timeout between digits
            Directory: Provide directory of voicemail extensions
[...]

Plus, you should rename ur application app_dialconfirm.c if its called dialconfirm instead of DialConfirmAnswer.

By: mochouinard (mochouinard) 2004-12-07 09:22:37.000-0600

Updated with junk-y patch, and added a few fix since the conversion from the threaded to the non threaded app.

Let me know how it goes

By: Olle Johansson (oej) 2004-12-19 07:52:06.000-0600

Any more test results? Is this app ready for CVS or still under development?

---housekeeping

By: mochouinard (mochouinard) 2004-12-23 23:25:43.000-0600

Ive being using it, only questions, it does we want to put it into CVS ? or Mark ratter wait that someone modify the app_dial to do the same thing ?

By: triplef (triplef) 2004-12-28 18:54:26.000-0600

ok this is not working.. this is dial sip but when answered it does nothing... then finishes by timing out.. any ideas ? this is v8 running


exten => 3036291337,1000,SetVar(foobar=${TIMESTAMP})

exten => 3036291337,1001,Playback(privacy_sayname)
exten => 3036291337,1002,Record(/tmp/asterisk-recording-temp:gsm)
exten => 3036291337,1003,WAIT(1)
exten => 3036291337,1004,Playback(privacy-thankyou)
exten => 3036291337,1005,Dialconfirm(SIP/triplef|60|rA('/tmp/asterisk-recording-temp.gsm'))

By: mochouinard (mochouinard) 2004-12-30 08:18:15.000-0600

do not specify the .gsm when sent to dialconfirm
also, press # to accept the call, or * (or hangup) to reject it

By: triplef (triplef) 2004-12-30 09:40:24.000-0600

Ok made it like this.. now in dials my sip, now when i answer it.. either it has 2 lines incoming one from asterisk ( dialconfirm) and one form ? err 482 loop detected..

when i asnwer it NEVER says message.. i tried rA and A .. whats R in RA ?

think its not working right ..

can you pm me on #asterisk and or icq 753-658-76




exten => 3036298337,1000,SetVar(foobar=${TIMESTAMP})

exten => 3036298337,1001,Playback(privacy_sayname)
exten => 3036298337,1002,Record(/tmp/asterisk-recording-temp:gsm)
exten => 3036298337,1003,WAIT(1)
exten => 3036298337,1004,Playback(privacy-thankyou)
exten => 3036298337,1005,Dialconfirm(SIP/triplef|60|A(/tmp/asterisk-recording-temp))

By: mochouinard (mochouinard) 2005-01-03 20:08:35.000-0600

Fixed some big problem, thanks triplef

By: syslod (syslod) 2005-01-03 21:26:28.000-0600

Currently it crashes * but I have patches related to AST_OBJ if that matters.  It starts and shows up in show applications. When exten using it is dialed * exits.

By: mochouinard (mochouinard) 2005-01-03 22:28:12.000-0600

Here is a new version, the only big problem I see so far is that the ringing sound weird (Multiple ringing sound get overlaps I beleive).  But it could be my phone. Please let me know. Thanks

By: mochouinard (mochouinard) 2005-01-04 00:19:24.000-0600

Here is another version, we got a feeling, it not working very well on a BSD system

By: syslod (syslod) 2005-01-04 01:09:09.000-0600

With v11 crashes on dialing extension with dialconfirm.

By: mochouinard (mochouinard) 2005-01-04 08:13:32.000-0600

I'll have to convert my code to use threads.... it just not posible without them.

By: mochouinard (mochouinard) 2005-01-04 14:12:18.000-0600

Updated the patch to use threads again.  I have totaly didnt test it, I just did the change and make sure it compiled fine.  I'll test it tonight when I get home.

By: siacali (siacali) 2005-01-04 16:49:00.000-0600

Currently, it seg faults * when called...

By: mochouinard (mochouinard) 2005-01-04 18:30:02.000-0600

here is another update

By: siacali (siacali) 2005-01-04 18:55:50.000-0600

At first glance Version 13 seems to work like a charm!  :-)

By: siacali (siacali) 2005-01-04 19:21:48.000-0600

Maybe it's a feature request or maybe it's a defect, but it seems to be impossible to send caller ID using DialConfirm.  Otherwise this version seems to function quite well...

By: syslod (syslod) 2005-01-05 12:58:29.000-0600

V13 Crashes upon use.  Linux Slack 10 and CVS HEAD.

By: syslod (syslod) 2005-01-07 12:42:34.000-0600

Dialconfirm with no options causes segfault.

By: mochouinard (mochouinard) 2005-01-07 19:19:36.000-0600

I'll see if I can fix app_dial so it can support the feature directly, alot of cleanup will be needed in it, but still, I'll let you guys know soon, in the mean time, use this version, but put a timeout and a Prompt

Thanks

By: mochouinard (mochouinard) 2005-01-12 22:12:05.000-0600

app_dial.c-confirm_rev1.txt is my last attempt to make this app_dialconfirm WITHIN app_dial, I'dlike comments on how it goes on your side.

By: siacali (siacali) 2005-01-13 10:05:51.000-0600

The basic functionality seems to work, but for some reason (perhaps my own fault?)  I haven't gotten an audio file to play through the v(x) function.  Trying to follow the earlier version of app_dialconfirm, I've tried:

exten => 1005,1,Dial(SIP/1001&SIP/1002|30|cv(/tmp/msg))

where /tmp/msg.gsm exists as an audio file.  I get back an error saying the file doesn't exist in any audio format.  Do I have the syntax correct, or is there a bug?

Also, the help provided under 'show application dial' states that the the 'c' provides 'confirm of answer with key 9'.  Seems to work with an '*' rather than a '9'.

By: mochouinard (mochouinard) 2005-01-13 10:12:16.000-0600

You are right for the 9, it * rightnow. I'll check the playback tonight

By: siacali (siacali) 2005-01-13 20:14:03.000-0600

Found the problem.  You're not parsing the trailing parentheses off the v(x) properly...otherwise seems to work!  I've been testing it with other options, and it seems to work properly with those too.

By: mochouinard (mochouinard) 2005-01-17 19:39:50.000-0600

ok here is a updated with CVS head, also fixed the parsing of v(x) mentioned by siacali.

By: siacali (siacali) 2005-01-17 23:47:44.000-0600

Looks like this was the wrong day to make it work with CVS head.  app_dial.c changed alot  from integrating bugs 1840, 2489, and 3313 and appears to have messed up your patch.  It no longer applies cleanly to CVS HEAD.  :-(

By: mochouinard (mochouinard) 2005-01-18 03:58:31.000-0600

new patch that work with head. He applyed the new patch just after I finish updating mine... it a conspiracy ;)

By: siacali (siacali) 2005-01-18 11:35:58.000-0600

This version of the patch applies well, and seems to work well too!  That's great!   Now, can you convince the powers that be to add this to CVS?

By: Mark Spencer (markster) 2005-01-19 22:05:56.000-0600

This patch shows promise certainly but contains a couple of flaws.  

1) The relatively easy one to fix is that the "confirm answer" should be handled by a similar block of code as the "answer" part.  Care should be taken that the "right thing" happens when more than one channel answers the line but hasn't confirmed.

2) Much more difficult to solve is that you cannot simply ast_streamfile / ast_waitstream in the middle of dial, while ignoring the other channels.  While you *could* use the ast_autoservice_start() and _stop() routines, that would not handle signalling and certainly would not permit multiple people to hear the message at the same time.

By: mochouinard (mochouinard) 2005-01-19 22:33:59.000-0600

Yes, the problem with the playback has bugged me too, The other way to handle it is to use threads in wait_for function, so each threads do it own stuff, but im sure you wont accept it.  So I don't know exactly how to handleit. I thought of adding a note to keep the v(x) recording as short as posible since all the other channel are being put on hold if they answer until the playback end.  Hope we can find something to do it.

By: siacali (siacali) 2005-01-31 22:11:01.000-0600

Unfortunately, the latest CVS HEAD breaks this patch.  Moc, have you thought any further on how to make this work so that it would be acceptable to add to CVS?

By: Mark Spencer (markster) 2005-02-02 13:49:14.000-0600

Something not entirely dissimilar to this could be done using chan_local i would think.

By: mochouinard (mochouinard) 2005-02-27 20:05:02.000-0600

what do you mean mark ? And why not do it in app_dial ?

By: mochouinard (mochouinard) 2005-03-16 20:53:06.000-0600

Mark wont accept this type of modification to app dial

By: mochouinard (mochouinard) 2005-03-25 23:38:59.000-0600

Ive closed this bug, but I really wish this feature get in...  So Im opening it again to know what mark didnt like about having it in app_dial

By: timrobinson (timrobinson) 2005-03-26 04:33:35.000-0600

I think this does belong in app_dial.  It is very useful when including e.g. mobile phones and other lines into the dialplan that have voicemail.

Confirm answer is a great way of ensuring that the call is not answered until the recipient accepts the call.  It is applicable to all types of channels.

By: mochouinard (mochouinard) 2005-03-26 10:00:23.000-0600

also my lastest version had the threading removed, but like I found out, I can't manage multiple channel correctly without them.  So I'll add them back to app_dial..

By: siacali (siacali) 2005-04-21 00:35:18

Any chance this will move forward?  I'd really love to see this functionality in app_dial.  I did try implementing this using Local as Mark suggested, but found it complex and not quite what I had wanted...this patch would be much better!

By: mochouinard (mochouinard) 2005-05-14 19:38:08

Mark stop hiding and please say what wrong so I dont have to waste my time again on this... but I do also like to have this feature in cvs! (since I made it)

By: Clod Patry (junky) 2005-06-13 18:45:25

Like discussed with moc, i'm closing it, since seems no really interest about all that. If someone wants to work on this and provide time to make many tests, ask a marshall in #asterisk-bugs.

Thanks.