Askozia Forums
May 17, 2012, 02:18:01 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Askozia executes every user defined application twice  (Read 1035 times)
Scapal
Full Member
***

Karma: 4
Posts: 58



View Profile
« on: August 30, 2010, 07:29:59 pm »

Askozia executes every user defined application twice because it has dial entries for each application: "s => "  and " '_[0-9a-zA-Z*#]!' => "

eg. The following application defined through the Askozia GUI on extension 005:
Code:
1,NoOp("Answering Machine Flag was ${DEVICE_STATE(Custom:answeringmachine)}")
n,GotoIf($[${DEVICE_STATE(Custom:answeringmachine)} = INUSE]?inuse:)
n(notinuse),NoOp(WasNotInUse)
n,Set(DEVICE_STATE(Custom:answeringmachine)=INUSE)
n,Goto(done)
n(inuse),NoOp(WasInUse)
n,Set(DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE)
n(done),Hangup()

Produces the following entry in the extension.conf

Code:
pbx*CLI> dialplan show APPLICATION-MAPPING-6837994c7bf960e0747
[ Context 'APPLICATION-MAPPING-6837994c7bf960e0747' created by 'pbx_config' ]
  's' =>            1. NoOp("Answering Machine Flag was ${DEVICE_STATE(Custom:answeringmachine)}") [pbx_config]
                    2. GotoIf($[${DEVICE_STATE(Custom:answeringmachine)} = INUSE]?inuse:) [pbx_config]
     [notinuse]     3. NoOp(WasNotInUse)                          [pbx_config]
                    4. Set(DEVICE_STATE(Custom:answeringmachine)=INUSE) [pbx_config]
                    5. Goto(done)                                 [pbx_config]
     [inuse]        6. NoOp(WasInUse)                             [pbx_config]
                    7. Set(DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE) [pbx_config]
     [done]         8. Hangup()                                   [pbx_config]
  '_[0-9a-zA-Z*#]!' => 1. NoOp("Answering Machine Flag was ${DEVICE_STATE(Custom:answeringmachine)}") [pbx_config]
                    2. GotoIf($[${DEVICE_STATE(Custom:answeringmachine)} = INUSE]?inuse:) [pbx_config]
     [notinuse]     3. NoOp(WasNotInUse)                          [pbx_config]
                    4. Set(DEVICE_STATE(Custom:answeringmachine)=INUSE) [pbx_config]
                    5. Goto(done)                                 [pbx_config]
     [inuse]        6. NoOp(WasInUse)                             [pbx_config]
                    7. Set(DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE) [pbx_config]
     [done]         8. Hangup()                                   [pbx_config]

-= 2 extensions (16 priorities) in 1 context. =-

Since it is executed twice, the switch always stays in its inital state:
Code:
  == Using SIP RTP CoS mark 5
  == Using SIP VRTP CoS mark 6
    -- Executing [005@SIP-PHONE-7224961394b99ebc8afdf2:1] NoOp("SIP/852-000001a4", "internal calling application: Flag") in new stack
    -- Executing [005@SIP-PHONE-7224961394b99ebc8afdf2:2] Dial("SIP/852-000001a4", "Local/005@APPLICATION-MAPPING-6837994c7bf960e0747/n") in new stack
    -- Called 005@APPLICATION-MAPPING-6837994c7bf960e0747/n
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:1] NoOp("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", ""Answering Machine Flag was NOT_INUSE"") in new stack
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:2] GotoIf("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "0?inuse:") in new stack
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:3] NoOp("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "WasNotInUse") in new stack
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:4] Set("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "DEVICE_STATE(Custom:answeringmachine)=INUSE") in new stack
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:5] Goto("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "done") in new stack
    -- Goto (APPLICATION-MAPPING-6837994c7bf960e0747,005,8)
    -- Executing [005@APPLICATION-MAPPING-6837994c7bf960e0747:8] Hangup("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "") in new stack
  == Spawn extension (APPLICATION-MAPPING-6837994c7bf960e0747, 005, 8) exited non-zero on 'Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2'
    -- Executing [h@APPLICATION-MAPPING-6837994c7bf960e0747:1] NoOp("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", ""Answering Machine Flag was INUSE"") in new stack
    -- Executing [h@APPLICATION-MAPPING-6837994c7bf960e0747:2] GotoIf("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "1?inuse:") in new stack
    -- Goto (APPLICATION-MAPPING-6837994c7bf960e0747,h,6)
    -- Executing [h@APPLICATION-MAPPING-6837994c7bf960e0747:6] NoOp("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "WasInUse") in new stack
    -- Executing [h@APPLICATION-MAPPING-6837994c7bf960e0747:7] Set("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE") in new stack
    -- Executing [h@APPLICATION-MAPPING-6837994c7bf960e0747:8] Hangup("Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2", "") in new stack
  == Spawn extension (APPLICATION-MAPPING-6837994c7bf960e0747, h, 8) exited non-zero on 'Local/005@APPLICATION-MAPPING-6837994c7bf960e0747-0afe;2'
    -- No one is available to answer at this time (1:0/0/0)
    -- Auto fallthrough, channel 'SIP/852-000001a4' status is 'NOANSWER'
Logged
giovanni.v
Hero Member
*****

Karma: 53
Posts: 670


View Profile
« Reply #1 on: August 31, 2010, 06:09:06 am »

Askozia executes every user defined application twice because it has dial entries for each application: "s => "  and " '_[0-9a-zA-Z*#]!' => "

The two pattern for each application exists to be compatible when an application is a target for calls that don't set an EXTEN variable, i.e. incoming target for analog calls.

However the s extension isn't the cause because your application executes two times... your call report shows that the second execution happens in the h extension.

This issue was already filed, the application behaviour in trunk askozia source is now reverted to be executed via macro() which may fix that issue.
Could you test the last developer snapshot (http://forums.askozia.com/index.php/topic,1343.0.html) then report any improvement?
Logged
Scapal
Full Member
***

Karma: 4
Posts: 58



View Profile
« Reply #2 on: August 31, 2010, 08:11:45 am »

Same problem with the r1701 snapshot. But as I can see, it still uses Dial, not macro.
Code:
pbx*CLI> module load func_devstate.so
Loaded func_devstate.so
  == Registered custom function 'DEVICE_STATE'
  == Registered custom function 'HINT'
 Loaded func_devstate.so => (Gets or sets a device state in the dialplan)
  == Using SIP RTP CoS mark 5
  == Using SIP VRTP CoS mark 6
    -- Executing [005@SIP-PHONE-1509994276497f5a82e776e:1] NoOp("SIP/810-00000015", "internal calling application: Out of Office Flag") in new stack
    -- Executing [005@SIP-PHONE-1509994276497f5a82e776e:2] Dial("SIP/810-00000015", "Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330/n") in new stack
    -- Executing [005@DIALPLAN-APPLICATION-12606051984c7cb9b781330:1] NoOp("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", ""Answering Machine Flag was INUSE"") in new stack
    -- Executing [005@DIALPLAN-APPLICATION-12606051984c7cb9b781330:2] GotoIf("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", "1?inuse:") in new stack
    -- Goto (DIALPLAN-APPLICATION-12606051984c7cb9b781330,005,6)
    -- Executing [005@DIALPLAN-APPLICATION-12606051984c7cb9b781330:6] NoOp("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", "WasInUse") in new stack
    -- Executing [005@DIALPLAN-APPLICATION-12606051984c7cb9b781330:7] Set("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", "DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE") in new stack
    -- Called 005@DIALPLAN-APPLICATION-12606051984c7cb9b781330/n
  == Extension Changed 005[internal] new state Idle for Notify User 810
    -- Executing [005@DIALPLAN-APPLICATION-12606051984c7cb9b781330:8] Hangup("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", "") in new stack
  == Spawn extension (DIALPLAN-APPLICATION-12606051984c7cb9b781330, 005, 8) exited non-zero on 'Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2'
    -- Executing [h@DIALPLAN-APPLICATION-12606051984c7cb9b781330:1] Goto("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", "h_bypass") in new stack
    -- Goto (DIALPLAN-APPLICATION-12606051984c7cb9b781330,h,9)
    -- Executing [h@DIALPLAN-APPLICATION-12606051984c7cb9b781330:9] NoOp("Local/005@DIALPLAN-APPLICATION-12606051984c7cb9b781330-8a13;2", ""OOF H Bypass"") in new stack
    -- No one is available to answer at this time (1:0/0/0)
    -- Auto fallthrough, channel 'SIP/810-00000015' status is 'NOANSWER'

You would maybe have to add a "extension => h" handler in the Application like this:
Code:
; Out of Office Flag
[DIALPLAN-APPLICATION-12606051984c7cb9b781330]
exten => h,1,Goto(h_bypass)
exten => _[0-9a-zA-Z*#]!,1,NoOp("Answering Machine Flag was ${DEVICE_STATE(Custom:answeringmachine)}")
exten => _[0-9a-zA-Z*#]!,n,GotoIf($[${DEVICE_STATE(Custom:answeringmachine)} = INUSE]?inuse:)
exten => _[0-9a-zA-Z*#]!,n(notinuse),NoOp(WasNotInUse)
exten => _[0-9a-zA-Z*#]!,n,Set(DEVICE_STATE(Custom:answeringmachine)=INUSE)
exten => _[0-9a-zA-Z*#]!,n,Goto(done)
exten => _[0-9a-zA-Z*#]!,n(inuse),NoOp(WasInUse)
exten => _[0-9a-zA-Z*#]!,n,Set(DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE)
exten => _[0-9a-zA-Z*#]!,n(done),Hangup()
exten => s,1,NoOp("Answering Machine Flag was ${DEVICE_STATE(Custom:answeringmachine)}")
exten => s,n,GotoIf($[${DEVICE_STATE(Custom:answeringmachine)} = INUSE]?inuse:)
exten => s,n(notinuse),NoOp(WasNotInUse)
exten => s,n,Set(DEVICE_STATE(Custom:answeringmachine)=INUSE)
exten => s,n,Goto(done)
exten => s,n(inuse),NoOp(WasInUse)
exten => s,n,Set(DEVICE_STATE(Custom:answeringmachine)=NOT_INUSE)
exten => s,n(done),Hangup()
exten => h,n(h_bypass),NoOp("OOF H Bypass")
Logged
Michael
Askozia Staff
Hero Member
*

Karma: 49
Posts: 1020


View Profile
« Reply #3 on: September 02, 2010, 10:35:38 am »

Would adding an 'h' handler into the generated logic solve your problem sufficiently or would some more extensive changes really make applications useful for you?

I've been throwing around some ideas on how to improve applications for 2.1. Some have already been implemented with the editor. Others I haven't decided on yet:
 - let the user define the entire block of logic, nothing auto-generated
 - let the user define the patterns separately from the logic
 - improve the patterns which are used in the auto-generation
 - include a separate block of logic to handle hangups and special extensions

I'm not a big fan of the first two because things have worked fine for most people so far. The 3rd and 4th options would be simple to implement and could help many people.

Feedback on this? Other suggestions?

Thanks for testing!
Logged
Scapal
Full Member
***

Karma: 4
Posts: 58



View Profile
« Reply #4 on: September 03, 2010, 06:40:07 pm »

Hi Michael,

I may not get the whole picture to understand why you use Dial(Local/${EXTEN}@DIALPLAN-APPLICATION-10297511314c7cb98c9bcf5/n) and the exten => _[0-9a-zA-Z*#]!
I would just use Goto() : Goto(DIALPLAN-APPLICATION-12606051984c7cb9b781330, s, 1)
and then, for a simple application just start with: exten => s,1,NoOp(Start of my Application)

You could then allow blocks in you editor, each block corresponding to an extension (default being s).

In case of a pattern as app numver, the Goto statement would be Goto(DIALPLAN-APPLICATION-12606051984c7cb9b781330, ${EXTEN}, 1) and let the user specify the app blocks patterns.

Full example:

Code:
[internal]
exten => 00001,1,NoOp(internal calling application: ivrtest)
exten => 00001,n,Goto(DIAPLAN-APPLICATION-ivrtest,s,1)

[DIAPLAN-APPLICATION-ivrtest]
  exten => s,1,Answer
  exten => s,2,SetMusicOnHold(default)
  exten => s,3,DigitTimeout,5
  exten => s,4,ResponseTimeout,10
  exten => s,5,Background(ivrtest-choose)

  exten => 1,1,Queue(rep-tech)

  exten => 2,1,Echo()
  exten => 2,n,Hangup()

  exten => i,1,Goto(s,5)

  exten => t,1,Goto(s,5)

This could result in the editor of the following sequence of blocks:

default (s):
Code:
1,Answer
2,SetMusicOnHold(default)
3,DigitTimeout,5
4,ResponseTimeout,10
5,Background(ivrtest-choose)

1:
Code:
1,Queue(rep-tech)

2:
Code:
1,Echo()
n,Hangup()

i:
Code:
1,Goto(s,5)

t:
Code:
1,Goto(s,5)

You could also decompose the _0001X application extension mask by having sections: 000011, 000012, _00001X ...

The editor would also have to provide a Goto() handler to be able to pick another Application by name from existing (possibly extension-less) application.
ie. Goto(DIAPLAN-APPLICATION-sales-ivr,s,1)

It keeps thinks easy for beginners while being powerful for the techies.

OR you could just stick to the 's' by default and provide a 'raw application' where one could key in whole app sections. This would be enough for me.

Could this be a valid option?

Kind Regards
« Last Edit: September 05, 2010, 12:58:35 pm by Scapal » Logged
Michael
Askozia Staff
Hero Member
*

Karma: 49
Posts: 1020


View Profile
« Reply #5 on: September 07, 2010, 08:21:41 am »

As handling the 'h' extension is rather important, I will add support for manually defining it.

The danger in making too many radical changes in the way something is handled in the gui is that backward compatibility must always be insured. People need to be able to upgrade their systems in confidence.
Logged
Scapal
Full Member
***

Karma: 4
Posts: 58



View Profile
« Reply #6 on: September 07, 2010, 10:54:34 am »

There are simply too many limitations and workaround needing to be implemented when adapting an Asterisk app for Askozia.

The GUI 'block' concept would only be there to hide the "exten => " prefix on each line, having the same exten for each block within an application.
The Goto(), avoiding the 'catchall' extension also avoid having to handle the 'h' extension not to execute the whole code twice.

Another way to do this would be to add an 'advanced application' or 'raw extension' where the user could write just the plain asterisk code (including exten => ...).

If you want to hide this from most users you could just add includes in the extension.cfg: one inside the "internal", custom-internal-extensions.cfg and one trailing custom-applications.cfg. That would already unlock things for advanced applications.
Logged
Michael
Askozia Staff
Hero Member
*

Karma: 49
Posts: 1020


View Profile
« Reply #7 on: September 07, 2010, 01:04:54 pm »

You can already append raw content to the extensions.conf file. Open the Integrator Panel (press 'ESC' anywhere to activate) and select the Files tab. There you can append anything you want.

The Askozia applications are treated more like individual extensions rather than contexts. Perhaps we need a context concept where a multitude of applications can be assigned with individual patterns to allow the routing you're talking about.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.152 seconds with 18 queries.