1. Incoming call, I set early media "Hi so and so..." followed by us-ring.
2. Bridge the call to internal group A rings for 17 seconds, if time out:
3. Internal group B rings for 1 second, same phones but different extension on them which causes a different ring that let's us know we are about to call cellphones.
4. Bridge call to internal phones again and 2 cell phones. If time out:
5. Play message and go to voicemail.
The problem is step 3. If the phone is picked up right in the 1 second the call is missed and the other phones keep ringing. I thought to try to combine step 2 and 3 into a single bridge command it may work. But... in another post I just made I realized it would be solved if I could just ring users/group without bridging the call that would solve the issues and be better. Have not found anything on the wiki yet.
BTW, the reason for the reset of the early media us-ring is if I don't do it the caller hears the first second of the Hi message. You can't put ringback into the bridge dialstring (I tried) I have to keep the 2 steps separate, which is why now I would just like to figure out how to dial without bridging but wonder what would happen when call is picked up during then.
<extension name="xxphone">
<condition field="destination_number" expression="^2920$">
<!-- Next lines allow control after bridge timeout and hangup after bridge -->
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<!-- While ringing inside caller will hear "hi name" then standard ring -->
<action application="set" data="ringback=file_string://${xxsounds}hi-long.wav!${sayname}!tone_stream://${us-ring};loops=-1"/>
<!-- ring home extensions only for ## seconds -->
<action application="bridge" data="[originate_timeout=17]group/home@${domain_name}"/>
<!-- ring different extension once so we know we're about to go to the second stage -->
<!-- ringback must be reset otherwise caller will hear a first second of previous early media for this 1 ring -->
<action application="set" data="ringback=${us-ring}"/>
<action application="bridge" data="[originate_timeout=1,ringback=${us-ring}]group/MGT@${domain_name}"/>
<!-- Say we are keep trying.... and setup so they hear music while ringing a second time-->
<!-- Using mod_file_string we can keep the phones ringing while playing sounds! -->
<action application="set" data="ringback=file_string://${xxsounds}hold_on.wav!${sayname}!${xxsounds}we_trying_please_hold.wav!local_stream://moh"/>
<!-- this is needed to allow call_timeout to work after bridging to a gateway -->
<action application="set" data="ignore_early_media=true"/>
<!-- ring home extensions +cell phone for ## seconds NOTE THE NEXT 2 LINES DID NOT WORK TO SET TIMEOUT -->
<!-- NOTE: The use of :_: invokes enterprise syntax to ring simoultaneously! ATT takes 8-10 rings before cell phone rings! -->
<!-- DIAL_GATEWAY is set in the public folder dialplans -->
<action application="bridge" data="<originate_timeout=23,origination_caller_id_number=${caller_id_number},origination_caller_id_name=${caller_id_name}>group/home@${domain_name}:_:sofia/gateway/${dial_gateway}/19163334444:_:sofia/gateway/${dial_gateway}/19161112222"/>
<!-- Timeout/No answer go to voicemail -->
<!--action application="playback" data="${xxsounds}leave_a_message.wav"/-->
<action application="playback" data="file_string://${xxsounds}please_leave_a_message.wav!//${sayname}"/>
<action application="answer"/>
<!-- Next line removes default greeting, we already played one above-->
<action application="set" data="skip_greeting=true"/>
<action application="voicemail" data="default ${domain_name} 100"/>
</condition>
</extension>