[asterisk-users] multiple softphone clients and same/different account credentials

C.Maj chris at PenguinPBX.com
Wed Nov 27 16:47:54 CST 2019

On 2019-11-26 20:05, Greg Troxel wrote:
> "C.Maj" <chris at PenguinPBX.com> writes:
>> Another option for a patch would be to extend the PJSIP_DIAL_CONTACTS
>> function with an argument such as 'please' to minimally return the
>> endpoint name in a Dialable format when no reachable contacts are found
>> eg. "PJSIP/bar" -- instead of the current empty string, which is not
>> Dialable.
> I thought of that also while considering if patching the way Dial
> behaves was feasible.  I think you are right that having
> PJSIP_DIAL_CONTACTS reduce to a single PJSIP/aor string will follow the
> principle of least astonishment.

Thanks, I put together a patch:


>> Also the empty string is somewhat in conflict with the Synopsis "Return
>> a dial string for dialing all contacts on an AOR." (Maybe add " Or
>> returns empty string if no reachable contacts. Do not Dial directly." ?)
>> Regardless of patch status, I'd recommend looking at the PUSH function
>> to build up the dial list one line item at a time -- please pardon the
>> AEL format on my example:
>>   Set(rgrp=);
>>   Set(PUSH(rgrp,&)=PJSIP/foo);
>>   Set(PUSH(rgrp,&)=PJSIP/baz);
>>   if( "${PJSIP_DIAL_CONTACTS(bar)}" != "" ) {
>>     Set(PUSH(rgrp,&)=${PJSIP_DIAL_CONTACTS(bar)});
>>   }
>>   Dial(${rgrp});
> That looks workable.  Is there a multiprocessing hazard here?  Could
> ${PJSIP_DIAL_CONTACTS(bar)} change between check and use.

Yes, if you put the Dial() further away, maybe after a Wait(), then it
could be a problem. But in this example, it is not going to be that much
slower than more 'direct' substitution Dial(${PJSIP_DIAL_CONTACTS(bar)})
because either way the PJSIP_DIAL_CONTACTS function is being evaluated
first and separately from the Dial() application itself. The application
only sees the results of the function.

Kind Regards,

🤠 C. Maj, Technology Captain @ Penguin PBX Solutions
📞 USA Toll Free 1-833-PNGNPBX (1-833-764-6729)
🤙 International & SMS Texting +1.720.
🐧 Visit on the World Wide Web at PENGUINPBX.COM

More information about the asterisk-users mailing list