TECH7Fox / asterisk-hass-integration

Asterisk integration for Home Assistant
57 stars 13 forks source link

End conference call after given time (for doorbell) #39

Closed Tekno-man closed 2 years ago

Tekno-man commented 2 years ago

It would be good after X time the conference room would auto close if no admin joins the room. I think this could be achieved using the TIMEOUT(response) option for default user dialing 444 and then on the 555 admin user side add the WaitExten(). I will give this a try and report back.

Tekno-man commented 2 years ago

I have tried adding exten => 444,4,Set(ConfBridge(default_user,timeout)=10) to the dialplan but I can't seem to get it to work. I'm not familiar with dial plans so trying to figure it out as I go.

TECH7Fox commented 2 years ago

It says here that there is a timeout variable for users. But I didn't test it.

I also recommend Visual Dialplan Pro. Easier to make dialplans. :)

TECH7Fox commented 2 years ago

If you do get it working, could you please tell me here so I can include it in the default config?

Tekno-man commented 2 years ago

Thanks for the software recommendation I will give that a go with different variables and let you know here once I have it working.

Tekno-man commented 2 years ago

I got the user timeout function to work but it only changes the time out for that channel you cant change the timeout value for a different user. There also doesn't seem to be a timeout function for the room itself. Can we use the AMI to end a conference call?

Here is the code, i tried to see if i could change the timeout of the first user. I also tried other combinations but it didn't make a diference.

[general] static=yes

[default] exten => 444,1,Progress() exten => 444,n,Wait(1) exten => 444,n,Set(CONFBRIDGE(user,template)=default_user) exten => 444,n,Set(CONFBRIDGE(user,TIMEOUT)=15) exten => 444,n,ConfBridge(1,myconferenceroom,)

; exten => 555,1,Progress() exten => 555,n,Wait(1) exten => 555,n,Set(CONFBRIDGE(user,template)=default_user) exten => 555,n,Set(CONFBRIDGE(user,TIMEOUT)=20) exten => 555,n,ConfBridge(1,myconferenceroom,)

; exten => _X!,1,Dial(SIP/${EXTEN})

Tekno-man commented 2 years ago

Trying to use gotoif statement instead. Need to read up about how to get it to work.

exten => 444,1,Progress() exten => 444,n,Wait(1) exten => 444,n,Set(CONFBRIDGE(user,template)=default_user) ;exten => 444,n,Set(CONFBRIDGE(user,TIMEOUT)=15) exten => 444,n,ConfBridge(1,myconferenceroom,) same => n,Wait(5) same => n,GoToIf($[0${CONFBRIDGE_INFO(parties,${ID})} <= 1]?hangup) same => n,Wait(1000000)

Tekno-man commented 2 years ago

The above wont work either, once the call reaches the conference room the flow stops. Would have to put the doorbell on hold first, then if someone else enters the conference room then get the doorbell to proceed to conference room

Tekno-man commented 2 years ago

Instead of using a confbridge could we just have the doorbell dial all SIP devices exten => 444,1,Dial(SIP/101&SIP/102&SIP/103&SIP/xxx) ?

TECH7Fox commented 2 years ago

Yes, you could easily do that. But the reason we used conference for doorbells, is so the extension doesn't have to be registered. Otherwise it won't ring.

When the card is fully working without any problems, I will continue with the integration. I will also add a function to control channels, like hangup. That way it is possible to hangup the doorbell from HA itself. It isn't ideal as doing it from the dialplan, but it will be possible.

Did you try the setting the timeout for a user? https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Configuration_app_confbridge https://wiki.asterisk.org/wiki/display/AST/Asterisk+17+Application_ConfBridge

Or by setting a timeout for the channel itself? https://asterisk-users.digium.narkive.com/JPjJkDqU/meetme-and-setting-conference-timeout

Sorry, I don't have much time right because of exams until 31, so I can't help much until then.

Tekno-man commented 2 years ago

Yes, you could easily do that. But the reason we used conference for doorbells, is so the extension doesn't have to be registered. Otherwise it won't ring.

ahhh I see fair enough.

It isn't ideal as doing it from the dialplan, but it will be possible.

I will keep trying to find solutions for the dial plan then in the meantime.

Did you try the setting the timeout for a user?

I did try this, values set only effect that channel being used, another user/channel command cant change the first users timeout.

Or by setting a timeout for the channel itself?

I looked many, many times for a confbridge timeout and there does not seem to be one as that would be a good solution (at least not with dial plan). If there is one I ma happy to be shown otherwise.

Sorry, I don't have much time right because of exams until 31, so I can't help much until then.

Don't be sorry, i am glad i can try and help contribute in some small way. even if it is finding things that don't work. I think one other option which could be a middle ground is to use a waiting list like in a call centre and so you can call all the extensions that are connected but can also use a card with no extension and just dial into the waiting list. Good luck with exams!

Tekno-man commented 2 years ago

Problem solved! Doorbell call should be placed into park and then any sip can dial the parkedcall position. The park function also has a time out option. Just trying to work out some kinks but the below is what I have so far.

Need to add the following res_parking.conf [default] parkext => 700 parkpos => 701-703 context => parkedcalls ; Which context parked calls and the default park parkingtime => 30 ; Number of seconds a call can be parked before returning comebacktoorigin = no ; Setting this option configures the behavior of call parking when the ; parked call times out (See the parkingtime option). comebackcontext = parkedcallstimeout ; The context a timed out call will return to if comebcktoorigin=no. ; The default value is 'parkedcallstimeout'. features.conf [general] parkext => 700 parkpos => 701 context => parkedcalls

extensions.conf include => parkedcalls

exten => 444,1,Park(,s)

exten => 555,1,ParkedCall(default,701)

[parkedcallstimeout] exten => s,1,NoOp(This is all that happens to parked calls if they time out.) same => n,Hangup()

TECH7Fox commented 2 years ago

Great! I will try it out when I have some time. This does seem much better and simpler then conference. Thank you for helping with this project!

Good luck with exams!

Thanks! 😄

pergolafabio commented 2 years ago

As discussed on discord, would be great if you can combine it ring groups/extensions so that regular sodftphones can be called too to be invited to the conference , that would be great...

For instance , sip indoor panels, that can only answer a call, they cant dial a number...

Or just users with a softphone, that don't receive any kind of notification from HA

pergolafabio commented 2 years ago

Also with conference/park, does DTMF work to open door? Don't think so, because if you press the # , how to define where that signal should arrive?

TECH7Fox commented 2 years ago

would be great if you can combine it ring groups/extensions

I tried, but the dialplan pauses at parking. Maybe there is a way to do both, but I couldn't find it. If someone does find a way, please let me know. :)

with conference/park, does DTMF work to open door?

Not sure about conference, but parking should work. Parking is just the same as dial when you pick it up.

how to define where that signal should arrive?

I think that the signal will arive in the entire call, it's just a sound tone. So it should work in conference too. But not sure.

pergolafabio commented 2 years ago

Yeah, it most be possible with Somekind of invite... I think it's quite comon in a real office environment?

To actually call external users to invite them into conference

pergolafabio commented 2 years ago

@Tekno-man , gonna paste your other stuff here too , to keep it organized, also an interesting road:

https://stackoverflow.com/questions/37527913/asterisk-ringgroup-get-call-after-registration

this strategy might be a better option either using queing (which is painful to set up) or just call ring group multiple times so if your card isnt registered teh first time, when you open the card then it will ring again i think maybe calling ring group 6 times for 5 seconds

exten => 444,1,Progress()
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)
exten => 444,n,Dial(SIP/100&SIP/8002&SIP/101,5)

Also this is more compact =

exten => 444,1,Progress()
exten => 444,n,RetryDial(wait.wav,4,10,SIP/100&SIP/8002&SIP/101) 
Tekno-man commented 2 years ago

@pergolafabio Thanks for adding, i had meant to but got busy. The last option is the best, i have been trialling it and it works well, Can play around with dial time length and number of attempts.

pergolafabio commented 2 years ago

i havent tested it yet, but in case of the 8002 for example, if that one is a softphone on an android, leys say you set the timeout on 4 seconds, you pickup after 20 seconds, then you have 5 missed calls? :-)

Tekno-man commented 2 years ago

yeh it looks like you do but small price to pay i think, until can figure outa better way

TECH7Fox commented 2 years ago

I'm gonna close this issue now, please continue posting your findings on discord or make a discussion here for long term use.