Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8504
  • Last Modified:

Multi extension call barge feature - Asterisk

Hi All,
I want to develop the Call Barge Feature for Asterisk.
The meaning of the barge that I need is :
When there is a call exist , let's say between the local extension and some other point ... I know the number of one of the extensions and I want to enter into the conversation. So from my extension I'll press the feature key and the extension number, then some kind of conference will be created , and the conversation will be between three extensions then ...
Good example for it : Child ,  talking to friend too long ... I want to call him for the launch , I'm entering to the call and telling to both of the sides to talk later... Or I'm telling to the child to go for launch , he is disconnecting , but I'm stay on the line with his friend.

Thanks .
0
aquasw
Asked:
aquasw
  • 11
  • 10
1 Solution
 
grbladesCommented:
You will need to be running asterisk version 1.4 to use this feature. Have a look at the extenspy command :-
http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+ExtenSpy

For example if the person you wish to barge in on has extension 100 then you could have :-

exten=>200,1,ExtenSpy(100,w)

Dialing 200 will then allow you to barge in on that call.
0
 
aquaswAuthor Commented:
How can I configure the key tone for barging in ? And if there is a way to know that some extension is talking right now ?
0
 
grbladesCommented:
What do you mean by key tone?

To know if some extension is talking you can use the 'show channels' command or if your phone support busy lamps (grandstream gxp-2000 for example) then you can define 'hints' in asterisk and the light on the phone against the particular extension will flash when it is ringing or be on when a call is in progress.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aquaswAuthor Commented:
Thanks for the answer ...
I mean that , when I'm calling to ext. 200, I will not always want to barge in. Let's say the user that want to barge haven't way to see that ext. 200 is on the call right now (I have simple LinkSys SPA921 phones).  
So when I want to barge , I'll dial  *33 for example , the extension number (200) .
Hope I explained it now :)

To where I need to add the "exten=>200,1,ExtenSpy(100,w)" , to extensions.conf , in the ext. 100 section ?
0
 
grbladesCommented:
You need to add the line in the same context (i.e same section)as where extension 100 is defined.

So you want to be able to dial *33. Then you get the extension to barge in on. Then you are told if there is an active call and if there is given the option to barge in?
0
 
aquaswAuthor Commented:
Right. On the second thought , it doesn't have to be a dial key ... Just when I'm calling to extension and only if there is an active call , I need to have an option to barge in .
0
 
grbladesCommented:
I would recommend that you do have a dial key. Having you able to barge in if the person you are calling is on the phone can have a number of issues as you would need to integrate the feature into the voicemail system which causes problems if call waiting is enabled on the phone. Also anyone dialing that extension (including external calls) would be able to barge in.

I'll write something which should do as a starting point for you and will probably work. I am still running asterisk 1.2 myself so I cannot test it.
0
 
grbladesCommented:
I saw in your other question that you are running asterisk 1.2. You will have to upgrade to asterisk 1.4 otherwise when you barge in you can only hear the other person and wont be able to talk to them.

As you are running trixbox you will need to follow their upgrade procedure. I am not that familar with trixbox myself so I cannot say how easy or difficult this is.
0
 
grbladesCommented:
Here is a macro. I plays an IVR menu which asks for the extension number. I am assuming your extensions vary from 100 to 199 but if they are different you can change the extension pattern '_1XX' to whatever matches.

It plays a message asking for the extension and then retrieves the extension status and puts it in the STATE variable. Then if the state is not in use it plays the goodbye message and hangs up. If no it plays the 'is on the phone' message waits 5 seconds (to allow you to hangup if you dont want to barge in) and then barges in.

The sounds I have chosen to play back are not entirely suitable so you might want to record your own.

The macro definition generally goes at the top of the extensions.conf file

[macro-bargein]
  exten => s,1,Wait(2)
  exten => s,n,Answer
  exten => s,n,Wait(1)
  exten => s,n,SetMusicOnHold(default)
  exten => s,n,Set(TIMEOUT(digit)=5)
  exten => s,n,Set(TIMEOUT(response)=10)
  exten => s,n(menu),Background(vm-extension)
  exten => _1XX,1,Set(STATE=${DEVSTATE(SIP/${MACRO_EXTEN})})
  exten => _1XX,n,GotoIf($[ "${$STATE}" = "NOT_INUSE" ]?free)
  exten => _1XX,n,Playback(vm-inonphone)
  exten => _1XX,n,Wait(4)
  exten => _1XX,n,ExtenSpy(${MACRO_EXTEN},w)
  exten => _1XX,n,Hangup
  exten => _1XX,n(free),Playback(vm-goodbye)
  exten => _1XX,n,Hangup
  exten => t,1,Wait(1)
  exten => t,n,Goto(1,1)
  exten => i,1,Playback(custom/invalidoption)
  exten => i,n,Wait(1)
  exten => i,n,Goto(s,menu)

To call the macro you would have a line like :-

exten => *33,Macro(bargein)
0
 
aquaswAuthor Commented:
Where do I need to put the line "exten => *33,Macro(bargein)" ?
extesions.conf too ?
0
 
grbladesCommented:
Yes that will also go in extensions.conf in the same section where your normal extensions are configured.

Note it uses a command which was added in asterisk 1.4 so you will need to upgrade otherwise it wont work at all.
0
 
aquaswAuthor Commented:
I've read about upgradin Asterisk 1.2 branch to 1.4 , from what I've understood , it it not recommended at all upgrading the branch 1.2 to 1.4 on TrixBox . Instead of it , it is recommended to upgrade to the latest build of 1.2 branch. It is interesting if the barge in supported in the latest builds of 1.2 ?
0
 
grbladesCommented:
No sorry according to the documentation the additional option to talk to the person when you have barged in was introduced as a new feature in the 1.4 release.
0
 
aquaswAuthor Commented:
May be this issue could be solved using conference rooms somehow ? Fro example , I'm using *33 and extension number , waiting for 5 seconds if there is a cell on this extension , then creating new conf. room and moving all three (me, called to extension and the person to whom he talked ) participants of the session to that room ?
0
 
grbladesCommented:
Yes in theory you could use a conference but you would have to move a channel to a new conference and the only way to do this would be to use the channelredirect command which is in asterisk 1.4.

The only thing you could do would be to have all calls use a conference by default.
When an incoming call was detected the dial plan would have to run a script to make a new call between the destination number and a new conference. If the call suceeded then put the callng person into the same conference. There would be all sorts of complications like having to check the conference was empty first and handling all the call hangups properly.
0
 
aquaswAuthor Commented:
Well , this solution really little complicated ...
I have code with n-way implemented on asterisk 1.2 , may be this guy implemented the ChannelRedirect by his own , I'll try to investigate his code ... But my feeling is that right direction is upgrading to 1.4 and using the barge , hope the upgrade will not cause me a lot of problems ...
0
 
aquaswAuthor Commented:
Hi grblades,
At last I found time for installing the 1.4 version of Asterisk.
- I've inserted the macro you gave to extension-custom.conf
- Also under [from-internal-custom] macro , I've inserted the exten => *33,Macro(bargein)

Now when trying to dial from one of the extensions I got an error message : "That feature is not available on this line" .
  -- Executing [*33@from-internal:1] ResetCDR("SIP/177-095860b0", "") in new stack
    -- Executing [*33@from-internal:2] NoCDR("SIP/177-095860b0", "") in new stack
    -- Executing [*33@from-internal:3] Wait("SIP/177-095860b0", "1") in new stack
    -- Executing [*33@from-internal:4] Playback("SIP/177-095860b0", "silence/1&feature-not-avail-line&silence/1&cannot-complete-as-dialed&check-number-dial-again|noanswer") in new stack
    -- <SIP/177-095860b0> Playing 'silence/1' (language 'en')
    -- <SIP/177-095860b0> Playing 'feature-not-avail-line' (language 'en')
  == Spawn extension (from-internal, *33, 4) exited non-zero on 'SIP/177-095860b0'
    -- Executing [h@from-internal:1] Macro("SIP/177-095860b0", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/177-095860b0", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("SIP/177-095860b0", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("SIP/177-095860b0", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("SIP/177-095860b0", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("SIP/177-095860b0", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("SIP/177-095860b0", "") in new stack
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/177-095860b0' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/177-095860b0'


 
0
 
grbladesCommented:
It doesnt look like you are using standard asterisk. Are you using something like trixbox?

It looks to me like it is not recognising *33 as being a valid extension.
I dont know why this is but it will be to do with the way the trixbox dialplan works.

Your best approach might be to post in the trixbox forums to ask how to implement the macro.
0
 
aquaswAuthor Commented:
to grblades:
Hi,
You right, I'm using trixbox with asterisk 1.4 ...
I've solved the problem with the dialplan , now when dialing *33 , I'm receiving the "Extension" message , then , the call falling up with message - "That feature is not available on this line".

This is the trace :

-- Executing [*33@from-internal:4] Playback("SIP/299-0895b7e8", "silence/1&feature-not-avail-line&silence/1&cannot-complete-as-dialed&check-number-dial-again|noanswer") in new stack
    -- <SIP/299-0895b7e8> Playing 'silence/1' (language 'en')
    -- Executing [*33@from-internal:4] Playback("SIP/299-0895b7e8", "silence/1&feature-not-avail-line&silence/1&cannot-complete-as-dialed&check-number-dial-again|noanswer") in new stack
    -- <SIP/299-0895b7e8> Playing 'silence/1' (language 'en')
trixbox1*CLI>     -- <SIP/299-0895b7e8> Playing 'feature-not-avail-line' (language 'en')
    -- <SIP/299-0895b7e8> Playing 'feature-not-avail-line' (language 'en')
trixbox1*CLI>     -- <SIP/299-0895b7e8> Playing 'silence/1' (language 'en')
    -- <SIP/299-0895b7e8> Playing 'silence/1' (language 'en')
trixbox1*CLI>     -- <SIP/299-0895b7e8> Playing 'cannot-complete-as-dialed' (language 'en')
    -- <SIP/299-0895b7e8> Playing 'cannot-complete-as-dialed' (language 'en')
trixbox1*CLI>   == Spawn extension (from-internal, *33, 4) exited non-zero on 'SIP/299-0895b7e8'
  == Spawn extension (from-internal, *33, 4) exited non-zero on 'SIP/299-0895b7e8'
trixbox1*CLI>     -- Executing [h@from-internal:1] Macro("SIP/299-0895b7e8", "hangupcall") in new stack
    -- Executing [h@from-internal:1] Macro("SIP/299-0895b7e8", "hangupcall") in new stack
trixbox1*CLI>     -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/299-0895b7e8", "w") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/299-0895b7e8", "w") in new stack
trixbox1*CLI>     -- Executing [s@macro-hangupcall:2] NoCDR("SIP/299-0895b7e8", "") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("SIP/299-0895b7e8", "") in new stack
trixbox1*CLI>     -- Executing [s@macro-hangupcall:3] GotoIf("SIP/299-0895b7e8", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:3] GotoIf("SIP/299-0895b7e8", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
trixbox1*CLI>     -- Executing [s@macro-hangupcall:6] GotoIf("SIP/299-0895b7e8", "1?skipblkvm") in new stack
    -- Executing [s@macro-hangupcall:6] GotoIf("SIP/299-0895b7e8", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Goto (macro-hangupcall,s,9)
trixbox1*CLI>     -- Executing [s@macro-hangupcall:9] GotoIf("SIP/299-0895b7e8", "1?theend") in new stack
    -- Executing [s@macro-hangupcall:9] GotoIf("SIP/299-0895b7e8", "1?theend") in new stack
trixbox1*CLI>     -- Goto (macro-hangupcall,s,11)
    -- Goto (macro-hangupcall,s,11)
trixbox1*CLI>     -- Executing [s@macro-hangupcall:11] Hangup("SIP/299-0895b7e8", "") in new stack
    -- Executing [s@macro-hangupcall:11] Hangup("SIP/299-0895b7e8", "") in new stack
trixbox1*CLI>   == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/299-0895b7e8' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/299-0895b7e8'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/299-0895b7e8' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/299-0895b7e8'
0
 
aquaswAuthor Commented:
Another question : in your macro , where is the "Digits reading" executing ?
0
 
grbladesCommented:
In my macro once it reches 'exten => s,n(menu),Background(vm-extension)' then it waits for digits to be entered until either a match is found or the timeout is reached.

I think what is happening is that trixbox has a default rule which matches anything dialed starting with a * and if the number does not match one of its own features then it plays back that message.
Normally if you dont have an extension defined when you try to dial it asterisk just gives an error code to the dialing phone.

Have you only posted the last part of the logs?
I really need to see everything from when you dialed the *33 number so I can see it calling the macro. Without that I cant see if the correct part of the dialplan is being called.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 11
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now