Check if user dials their own extention

Hello everyone this is my first post!

im relatively new to asterisk so please help me out here like im a noob
(I am a programmer though. I am just new to asterisk)

So I am designing and building a simulation of a vintage phone system

the Idea is everyone in the group has an ATA once you take the phone off the hook you get a vintage dialtone with vintage reorder, busy, intercept, operator services

Everything is working fine so far.

The only thing I need to do in asterisk is see if the user dials their own extention

and if they do play an audio file then hangup

Check if CALLERID(num) and EXTEN have the same value.

Could you elaborate on that and give a demo script and what file i would put it in
(Im a noob)

No… That would be free consultancy. You need a basic understanding of how to write dialplans to benefit from these forums.

I came up with

;# // BEGIN NOYOL

exten => s,1,GotoIf($["${CALLERID(num)}" = “${EXTEN}”]?noyolm)
exten => s,2,n(noyolm),Playback(ss-noservice)

;# // END NOYOL

But it’s not working

I put it in extentions_custom.conf

NOYOL means

Number On Your Own Line

if you where curious

Maybe I’m not reloading right?

I did

fwconsole reload

I’m running IncrediblePBX 13-13

There are too many fields on the second line.

Also conditionally jumping to the next line does no more than a no-operation.

Also ${EXTEN} is s, so you no longer have the original extension if you can reach this code, or you never had it at this stage in the call.

If you are using a macro, after noting that macros are deprecated, see https://wiki.asterisk.org/wiki/display/AST/Macros#Macros-VariablesandargumentsavailablewithinaMacro for the correct variable to access.

I tried this and it’s still not working

;# // BEGIN NL

exten => 1,n,GotoIf($["${CALLERID(num)}" = “${EXTEN}”]?nl)
exten => 2,n(nl),Playback(ss-noservice)

;# // END NL

Please help me this isn’t working and I dont know why and I dont know what im doing and the documentation is not good.

(Disparaging the documentation is not going to make many friends :slight_smile: )

It’s not working because you don’t understand the meaning of a dialplan statement. The most basic format is:

exten = <extension>,<priority>,<command>

You are confusing the extension with the priority and you don’t understand what ‘n’ means.

The extension ‘groups’ statements that will be executed based on the value of ${EXTEN} (ignoring ‘goto’ and other flow control commands for the moment) when the context is entered.

The priority specifies the order the statements in the group will be executed.

‘n’ is short-hand for 'the value of the priority of the previous statement + 1.

Since you don’t have any statements with the priority defined, ‘n’ has nothing to increment and is thus undefined.

Since you referenced ‘extentions_custom.conf’ (SIC) in a previous post, this suggests you are using FreePBX. You will find very little support on this forum for anything other than ‘command line Asterisk.’

If you were using ‘command line Asterisk’ you (assuming you set your debug and verbose settings appropriately) would have seem:

[Sep 1 20:40:27] WARNING[19973]: pbx_config.c:1765 pbx_load_config: Can’t use ‘next’ priority on the first entry at line x of extensions.conf!
[Sep 1 20:40:27] WARNING[19973]: pbx_config.c:1765 pbx_load_config: Can’t use ‘next’ priority on the first entry at line x of extensions.conf!

which may have given you a clue (aka, google it) to the source of your errors.

Since you are (probably) using FreePBX, the error messages probably would have been missed amongst the cruft.

You may find reading this helpful.

Once you figure out how to ‘block’ this single extension, think about how you will block the rest. Will you replicate the same lines over and over, changing the extension or would using a pattern for the extension work better? Please don’t try working with patterns until you get a single extension working.

1 Like

If you are using FreePBX I recommend trying their forum at htttps://community.freepbx.org

I thought it was a play on #yolo… serious disappoint :slight_smile: