Re: Asterisk Sample Dialplan Help

153 views
Skip to first unread message

Dan Christian Bogos

unread,
Feb 7, 2024, 12:42:16 PM2/7/24
to cgr...@googlegroups.com

Hi Aegis,


Sorry for delay, please find answers bellow:

On 27.12.23 12:51, Aegis wrote:
Good Day Team,

Could someone help me understand the below sample dialplan, I have put in more daetails that I think I get:

[internal]
 exten => _1XXX,1,NoOp()
 same => n,Set(CGRMaxSessionTime=0); use it to disconnect automatically the call if CGRateS is not active
 same => n,Set(LIMIT_WARNING_FILE=/var/lib/asterisk/sounds/en/beep) ;Soundfile for call limits
 same => n,Set(LIMIT_PLAYAUDIO_CALLER=YES) ;Soundfile for call limits
 same => n,Set(LIMIT_PLAYAUDIO_CALLEE=YES) ;Soundfile for call limits
 same => n,DumpChan() ;Dump Info About The Calling Channel
 same => n,Stasis(cgrates_auth,cgr_reqtype=*prepaid,cgr_routes=supplier1,cgr_flags=*accounts+*attributes+*resources+*stats+*routes+*thresholds) ;Invoke a Stasis application.
 same => n,Set(CHANNEL(hangup_handler_push)=hangUp,hUP,1) ;Used to push a hangup handler onto a channel.
 same => n,Dial(PJSIP/${EXTEN},30,L(${CGRMaxSessionTime}:10000)))
 same => n,Hangup()

[hangUp]
exten => hUP, 1, NoOp(Hang Up)
exten => hUP, 2, GotoIf($["${ANSWEREDTIME}000" != "${CGRMaxSessionTime}"]?exitHangUP:logHangUP)
exten => hUP, 3(logHangUP),Log(WARNING,"Was closed because the max session time")
exten => hUP, 4(exitHangUP),Return()

I am not getting the Stasis part and the arguments as well as that hangUp context?

In the stasis part you we are identifying the stasis application (cgrates_auth) which will receive updates regarding a particular channel (when we are out of stasis completely, we have to keep being updated from Asterisk regarding channel states).

cgr_reqtype will give us the possibility of selecting the request type in CGRateS. We can also leave that blank and CGRateS will select it out of general section of the configuration.

cgr_routes is just some extra parameter which we will pass to CGRateS (and will show up in events), it means not much for CGRateS but it can be used in filters/AttributeS going further. You can put here any additional parameters you want in order to help you with the integration and filters.

cgr_flags are used to enable particular subsystems in CGRateS (in this case AccountS for balances and rates, attributes for event content mangling, resources for authorization, stats for calculating stats, routes for returning LCR and thresholds for various Fraud Detection scenarios).


The hangUp part is more proof of concept showing you how you can further enhance the desconnect (log part).



In my lab, all is well except getting CDRs in StorDB (MySQL) - I see no Asterisk call detail records whatsever and the only steps I am not sure off is this dialplan.

Based on the create_cdr configuration in asterisk_agent, you should enable CDRs to be generated.

https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L643


Good luck!


DanB


Regards,

Aegis
--
You received this message because you are subscribed to the Google Groups "CGRateS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cgrates/c648cee0-541d-4c03-884d-16338b92124fn%40googlegroups.com.

Aegis

unread,
Feb 13, 2024, 4:06:31 AM2/13/24
to CGRateS
Good Day Dan,

Thanks for your feedback - much appreciated.

So just to add, for my internal extension dialing and PSTN dialing I model/configure it around this sample dialplan, correct?

Or I can choose not to setup around these contexts but the rating still happens?

Dan Christian Bogos

unread,
Feb 16, 2024, 7:29:09 AM2/16/24
to cgr...@googlegroups.com

Hi Aegis,

In your asterisk dialplan, you should call Stasis application for any calls you want to authorize with CGRateS. Otherwise you should just bill out of offline CDRs (see ERs component).


DanB

Aegis

unread,
Feb 19, 2024, 2:33:20 AM2/19/24
to CGRateS
Aaah OK got you on that one.

Many thanks Dan!
Reply all
Reply to author
Forward
0 new messages