Where to put code

phpboy
Posts: 6
Member Since:
2008-01-11

I've been investigating the following for quite some time with no luck.
I'm trying to execute the following Unix command on all out going and incoming calls:-

For incoming calls:-
exten => s, n, system(echo "IN#${CALLERID(name)} #${CALLERID(number #${UNIQUEID}" > /tmp/panels/cid/${UNIQUEID})

For outgoing calls:-
exten => s, n, system(echo "OUT##${EXTEN}#${UNIQUEID}" > /tmp/panels/cid/${UNIQUEID})

The reason why I want to do this is so that I can track the specified directory from my website(which is permanently open) in order to identify calls and store them on my system.

This process does however go further than the asterisk MySQL call storage facility has to offer.

Any help would be appreciated. I am of course open to other suggestions and or questions.

Thanks,
Shane James



jfinstrom
Posts: 883
Member Since:
2007-03-07
I would check that

I would check that asterisk:asterisk has read/write permissions to said folder and review the full log

--

James
Community Manager
Rhino Equipment
All Products U.S. Made and Supported



dickson
Posts: 1424
Member Since:
2006-06-02
INBOUND is a little

OUTBOUND:
open up extensions.conf
goto the context
[macro-dialout-trunk]

scroll down and find the two lines, and insert your code BETWEEN those lines.

exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS})

INBOUND (Please test this piece extra carefully)
goto the context
[from-pstn]
DIRECTLY underneath that heading insert your code as:
exten => _X.,1,system(echo "IN#${CALLERID(name)} #${CALLERID(number)} #${UNIQUEID}" > /tmp/panels/cid/${UNIQUEID})

Save changes,
reload config
test.



jfinstrom
Posts: 883
Member Since:
2007-03-07
freepbx can rewrite

freepbx can rewrite extensions.conf at anytime probably be best to not ass changes in said file

--

James
Community Manager
Rhino Equipment
All Products U.S. Made and Supported



dickson
Posts: 1424
Member Since:
2006-06-02
I don't recall AMP/FreePBX

I don't recall AMP/FreePBX ever overwriting extensions.conf. Even in an upgrade i don't recall it happening. I know it has changed between trixbox builds, (which is why you always keep notes about modifications you make and do regression testing when you do updates ;) )

Day to day normal FreePBX administration, I've never seen it happen (although would be interested in knowing if it can be done...add a 'what not to do' to my list)



phpboy
Posts: 6
Member Since:
2008-01-11
INBOUND is a little

I've played around with your INBOUND and OUTBOUND suggestion and no luck, is there pehaps some more info you'd like to have regarding this issue?



dickson
Posts: 1424
Member Since:
2006-06-02
..interesting. What version

..interesting. What version are you using?



phpboy
Posts: 6
Member Since:
2008-01-11
version

v2.2



dickson
Posts: 1424
Member Since:
2006-06-02
Two things. 1- might be your

Two things.
1- might be your code. Change the first bit to reduce the spaces.

FROM:
exten => s, n, system(echo
TO:
exten => s,n,system(echo

2-
Test this:
Instead of /tmp/panels/cid/
Just put it in /tmp/${....



phpboy
Posts: 6
Member Since:
2008-01-11
Info

Ok, let's play around with OUTGOING first. Here is the EXACT code for that put where you told me to put it under [macro-dialout-trunk]

exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n,system(/bin/echo "bleh" > /tmp/bleh);
exten => s,n,system(echo "OUT##${EXTEN}#${UNIQUEID}" > /tmp/panels/cid/${UNIQUEID})

I don't know if this will help your understanding of my setup a bit more, but I have 4 trunks configured using mISDN and I've set the outgoing route which is 0|. to use 2 of the 4 trunks as 2 of them are offline for the time being.



phpboy
Posts: 6
Member Since:
2008-01-11
Correct Paste

Sorry, just to correct my code paste:-
exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n,system(/bin/echo "bleh" > /tmp/bleh);
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS})



phpboy
Posts: 6
Member Since:
2008-01-11
I believe I've got outgoing

I believe I've got outgoing working correctly:-
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)}) ; this is where we expect to find string OUTNUM
exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)})
exten => s,n,system(/bin/echo "OUT##${OUTNUM}#${UNIQUEID}" > /tmp/${UNIQUEID})
exten => s,n,GotoIf($["${the_num}" = "OUTNUM"]?outnum:skipoutnum) ; if we didn't find "OUTNUM", then skip to Dial
exten => s,n(outnum),Set(the_num=${OUTNUM}) ; replace "OUTNUM" with the actual number to dial
exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)

Let me know if that's the correct way of doing it? Now onto INCOMING, any ideas?



dickson
Posts: 1424
Member Since:
2006-06-02
Anyway that gets the job

Anyway that gets the job done is correct!
Looks like its all good.

Now inbound. I'm not familiar with the mISDN system...but I'm assuming that it uses the same contexts for other inbound calls from telcos. If you put the bit of code in below, and place a test call, does it show up in the live log ( asterisk -cvvvvvvr )

[from-pstn]
DIRECTLY underneath that heading insert your code as:
exten => _X.,1,NoOp(&&&&&&&&&&&& INBOUND TEST &&&&&&&&&&&&&&&)

save, reload config
place test call.
(Does the above "&&&&&&& INBOUND TEST &&&&&" statement show up in the live log)

If it does, then this is where you would want to put the code in. It should be the basic same line that you had put in for your outbound. It works on my systems 2.2.X and 2.4



KodaK
Posts: 1691
Member Since:
2006-06-14
dickson wrote:I don't recall
dickson wrote:
I don't recall AMP/FreePBX ever overwriting extensions.conf. Even in an upgrade i don't recall it happening.

I have to re-order some stuff in extensions.conf because of some hacks I made. Every time I upgrade the core module of freepbx it overwrites extensions.conf, and then I have to go re-order everything again.

--

I'm happy to try to help in these forums for free, but if you feel compelled, or if you desire one on one help, my Paypal address is: sakodak@gmail.com



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.