Jump to content


Photo
- - - - -

Asterisk and in-band signaling


  • Please log in to reply
16 replies to this topic

#1 nwbell

nwbell

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 339 posts
  • Location:320-land

Posted 14 July 2006 - 06:27 PM

Does anybody here know of a way to include tone control (outside of DTMF) in the Asterisk dialplan? I am hoping to use such a thing to make a ghetto VoIP payfone.

The idea would be to do something like:

- User dials number on payfone connected to ATA
- Play back "insert-35-cents"
- Wait for 1700+2200 to be played in the proper order (for instance, a dime and a quarter - 66ms on, 66ms off, 66ms on, undetermined pause, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off)
- Money drops into the cash can by way of the stuck-open escrow relay - that's what makes it a GhettoPayfone™
- Playback "thank-you"
- Dial the number

Any ideas?

#2 BrakeDanceJ

BrakeDanceJ

    Hakker addict

  • Binrev Financier
  • 598 posts
  • Location:Chicago

Posted 14 July 2006 - 06:44 PM

Does anybody here know of a way to include tone control (outside of DTMF) in the Asterisk dialplan? I am hoping to use such a thing to make a ghetto VoIP payfone.

The idea would be to do something like:

- User dials number on payfone connected to ATA
- Play back "insert-35-cents"
- Wait for 1700+2200 to be played in the proper order (for instance, a dime and a quarter - 66ms on, 66ms off, 66ms on, undetermined pause, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off, 33ms on, 33ms off)
- Money drops into the cash can by way of the stuck-open escrow relay - that's what makes it a GhettoPayfone™
- Playback "thank-you"
- Dial the number

Any ideas?


nwbell, that would be an awsome idea. A payphone module for asterisk! :-)

Hmmm, could a "voice recognition" software be used to detect the tones? i know there was a unix war dialer out there that used a "voice recognition" concept to detect carriers and SIT tones.

#3 spoekalb

spoekalb

    DDP r0x0rz my s0x0rz

  • Agents of the Revolution
  • 1,280 posts
  • Gender:Male

Posted 14 July 2006 - 09:47 PM

I looked into this a while back but I came up fruitless. I even looked at writing ACTS support into Asterisk, but what I learned is Asterisk doesn't "hear" tones at all. It takes digital messages from the actual interface to the PSTN. Be it a TDM400P or PRI card. So to build support for this you will have to write it into the driver for the card you're using or design your own hardware. I'm not sure which.

#4 natas

natas

    De La Natas

  • Agents of the Revolution
  • 4,273 posts
  • Gender:Male
  • Location:The Old Skool

Posted 15 July 2006 - 03:20 AM

Phiber Optik will be discussing this in a week at HOPE so we'll just have to wait until then I guess.

#5 nwbell

nwbell

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 339 posts
  • Location:320-land

Posted 15 July 2006 - 10:41 AM

Phiber Optik will be discussing this in a week at HOPE so we'll just have to wait until then I guess.


Yeah, I read about that - in fact, that was what gave me hope (no pun intended) for this project. I won't be able to make it out there, but maybe somebody could ask him for me ;)


This all ties together with the reason I needed the enclosures - for that county fair. They decided to up the number of fones they wanted to 4, but only 2 of my 4 units are converted (WECo single-slotter with a Protel 8000 chassis, IAXy, and Linksys WET11, all on a pedestal); the others are plain-stock. Being as it starts next week, maybe I'll just have to recruit an operator, set up a queue for them in Asterisk, and train them to listen for the proper ACTS tones before transferring the caller.

The whole goal is to provide wireless VoIP payfones during the fair. There is already DSL on site, so I will just set up a WAP and place the rigs in convenient places. Then all I have to do is leave a roll of quarters at the fair office (for refunds), and go back to my place and man the phone at extension '0'.

All the calls will be going out over VoIPjet and/or Voxee. I will be charging 35 cents flat for local and 20 cents per minute for long distance, so the project might actually make me a hundred or more bucks if I'm lucky (hence why I didn't just spring for a couple more Protel 8000 chassis - I already spent more than that on the two extra IAXy's and wireless bridges).


BTW, if any people in teh 320 read this, PM me and I'll tell you what county these are going to be in. There's tons of phreaky schtuff set up in the switch that serves these fones, and you may want to play with them if you get a chance. There are lots of cool test numbers, an extender, and other goodies to be found. (HINT: try 1-800-666-6666, and scan at least the 99xx block)

#6 mystic

mystic

    H4x0r

  • Members
  • 30 posts

Posted 17 July 2006 - 07:45 PM

here's what you could do...

1. have asterisk record the tones (to a wav file for example)
2. have asterisk call an agi app that analizes the tones
3. have the app return wether or not they are correct

there may also be a way to stream the call sound to an app, but I'm not sure.

but inorder for this to work you would have to have a constant open connection with asterisk, not sure how you could do this though.

Edited by mystic, 17 July 2006 - 07:55 PM.


#7 I-baLL

I-baLL

    T0tal n00b

  • Agents of the Revolution
  • 1,373 posts
  • Country:
  • Gender:Male
  • Location:New york

Posted 18 July 2006 - 12:06 PM

here's what you could do...

1. have asterisk record the tones (to a wav file for example)
2. have asterisk call an agi app that analizes the tones
3. have the app return wether or not they are correct

there may also be a way to stream the call sound to an app, but I'm not sure.

but inorder for this to work you would have to have a constant open connection with asterisk, not sure how you could do this though.


Yeah, I was thinking about this yesterday. You can use Monitor() to possibly do this.

#8 Strom Carlson

Strom Carlson

    Nub

  • Members
  • 2,575 posts
  • Gender:Male
  • Location:Los Angeles

Posted 18 July 2006 - 05:06 PM

here's what you could do...

1. have asterisk record the tones (to a wav file for example)
2. have asterisk call an agi app that analizes the tones
3. have the app return wether or not they are correct

there may also be a way to stream the call sound to an app, but I'm not sure.

but inorder for this to work you would have to have a constant open connection with asterisk, not sure how you could do this though.


Ugh, what a hack. Write tone recognition into Zaptel or chan_iax :)

#9 nwbell

nwbell

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 339 posts
  • Location:320-land

Posted 18 July 2006 - 05:21 PM

Ugh, what a hack. Write tone recognition into Zaptel or chan_iax :)


For the record, I'm dealing with an IAX device (not sure if I said that or not).

#10 Strom Carlson

Strom Carlson

    Nub

  • Members
  • 2,575 posts
  • Gender:Male
  • Location:Los Angeles

Posted 18 July 2006 - 05:28 PM


Ugh, what a hack. Write tone recognition into Zaptel or chan_iax :)


For the record, I'm dealing with an IAX device (not sure if I said that or not).


Ah...an IAXy? :)

What I think would actually be the most elegant way to handle it would be to build full coin control support into zaptel. Theoretically, the S110m FXS modules can generate just enough juice to operate the solenoid and do coin collect / return.

Unfortunately, my C skills blow, and my hardware driver skills blow even more :)

#11 nwbell

nwbell

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 339 posts
  • Location:320-land

Posted 19 July 2006 - 07:31 PM

Ah...an IAXy? :)


Indeed. They're not cheap, but they work amazingly well - my switch lives behind a NAT, and all I have to do is open one port and reprovision the IAXy, and it's soup.

What I think would actually be the most elegant way to handle it would be to build full coin control support into zaptel. Theoretically, the S110m FXS modules can generate just enough juice to operate the solenoid and do coin collect / return.

Unfortunately, my C skills blow, and my hardware driver skills blow even more :)


Same here. I wouldn't begin to be able to write something like that, but I would sure as hell put it to good use if somebody else did :)

By the way, what is the correct way to write the plural of IAXy?

#12 Strom Carlson

Strom Carlson

    Nub

  • Members
  • 2,575 posts
  • Gender:Male
  • Location:Los Angeles

Posted 19 July 2006 - 07:39 PM

By the way, what is the correct way to write the plural of IAXy?


I asked some guys at Digium, and they seem to think it's probably "IAXies" :)

#13 rudholm

rudholm

    the 0ne

  • Members
  • 1 posts

Posted 02 October 2006 - 02:14 AM



Ugh, what a hack. Write tone recognition into Zaptel or chan_iax :)


For the record, I'm dealing with an IAX device (not sure if I said that or not).


Ah...an IAXy? :)

What I think would actually be the most elegant way to handle it would be to build full coin control support into zaptel. Theoretically, the S110m FXS modules can generate just enough juice to operate the solenoid and do coin collect / return.

Unfortunately, my C skills blow, and my hardware driver skills blow even more :)


I'm interested in doing the same thing. The WECO 2C2 in my house is connected to a coin service line from SBC at the moment, which is nice since the phone works as it should. But coin service is an expensive novelty (over 60$/month after taxes). I'm seriously contemplating writing coin detect into zaptel. I'd just like to make sure nobody else has already done it (not into re-inventing the wheel).

As far as coin relay control goes, you need +/-130VDC between ground and tip. In my case, "ground" can just be a third conductor between Asterisk and the payphone. This would require hardware, since the TDM400 isn't capable of producing electrical potentials with respect to ground (or in my case, that third conductor instead of real ground). But this would be relatively simple to do with a script and AGI. Just set some of the lines on your parallel port to control a relay that sends the DC signal voltage to the coin relay. In fact, with EAGI, you have access to the audio stream in one of the file descriptors, so it would be possible to do the tone detection there rather than in the driver. But it seems likely that doing it in the driver may be easier and more reliable (since it's set up for dual-tone detection already).

#14 nwbell

nwbell

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 339 posts
  • Location:320-land

Posted 03 October 2006 - 07:26 PM

http://www.projectmf.com/

This would likely be the place to start, but I haven't done much with it yet - been too busy.

#15 armeniki

armeniki

    SCRiPT KiDDie

  • Members
  • 25 posts
  • Gender:Male

Posted 07 December 2010 - 01:26 AM

Hi guys,

I know this thread's been dormant for a while but I've been interested in getting something like this up and running with Asterisk as well....

Given that Asterisk has the "busydetect" - can't we just modify that to detect the coin deposited tones?

I finally got around to requesting the polarity-reversal feature on the Digium bugs site and was successful in getting someone to code it in for me.. so that's already taken care of (as at May 2010)... so really it comes down to coin detection and voltage control which I'm sure can be coded in to the Dahdi drivers someplace??

Cheers

#16 chronomex

chronomex

    mad 1337

  • Members
  • 136 posts
  • Gender:Not Telling
  • Location:STTLWA

Posted 18 December 2010 - 03:08 AM

Hi guys,

I know this thread's been dormant for a while but I've been interested in getting something like this up and running with Asterisk as well....

Given that Asterisk has the "busydetect" - can't we just modify that to detect the coin deposited tones?

I finally got around to requesting the polarity-reversal feature on the Digium bugs site and was successful in getting someone to code it in for me.. so that's already taken care of (as at May 2010)... so really it comes down to coin detection and voltage control which I'm sure can be coded in to the Dahdi drivers someplace??

I've actually put some effort into this recently. At a local hackerspace, a friend and I are putting in a nickel payphone. It charges a nickel for any call in the world, except maybe Cuba and satphones because they're so expensive. I'm approximately the world's least enthusiastic Asterisk fan, so I used this as a project to learn how to use FreeSWITCH. (More about why I hate Hurrsterisk later, if you care. FreeSWITCH is configured in XML, for better or for worse, is written by competent programmers, and has a bit steeper learning curve than Asterisk.)

Among other things, the payphone has a Linksys PAP2 in it, set up to operate as a hotline to <sip:dialtone@switch.host-name>. Here's what I have so far on the FreeSWITCH side of things, stripped of identifying words and irrelevant bits.

  <context name="payphone" description="Dialplan for payphone">
    <extension name="dialtone">
      <condition field="destination_number" expression="^dialtone$">
        <variable name="nibble_account" value="1" />
        <action application="set" data="nibble_rate=0.05" />
        <!-- give the man a nickel -->
        <action application="tone_detect" data="nickel 2200,1700 r 0 nibblebill 'adjust 0.05' 1" />
        <action application="read" data="1 18 'tone_stream://%(20000,0,350,440)' dialled 20000 '#'" />
        <action application="transfer" data="${dialled}"/>
        <!-- <action application="info"/> -->
      </condition>
    </extension>

    <extension name="outbound_free" -- usa toll-free -->
      <condition field="destination_number" expression="^\+(18(00|88|77|66|55)\d{7})$">
        <!-- <action application="set" data="nibble_rate=0.00"/> -->
        <action application="bridge" data="sofia/gateway/outbound/$1"/>
      </condition>
    </extension>
     
    <extension name="outbound_paid" -- all paid calls -->
      <condition field="destination_number" expression="^\+(\d+)$">
        <!-- <action application="set" data="$${nibble_account}"/> -->
        <action application="bridge" data="sofia/gateway/outbound/$1"/>
      </condition>
    </extension>
  
  </context>
It's not perfect, and in fact not really tested at all. For charging to work correctly, the ATA you use has to support early forward audio, which most seem to do.

There are a lot of extension patterns in there that translate dialstrings into phone numbers (1-NXX-NXX-XXXX => +1NXXNXXXXXX, 011-X* -> +X*, etc.); these mostly end up in the outbound_paid or outbound_free extensions eventually.

The dialtone extension collects digits and nickel tones. Every time it detects a nickel it increments the mod_nibblebill module's internal money counter by five cents, and every time it detects a DTMF digit it adds that to the current dialstring. I'm not sure how well that will work with quarters, but it should work okay with nickels and maybe dimes too. We're charging a nickel, so why would anyone put in a quarter? :)

#17 Mr. X

Mr. X

    I broke 10 posts and all I got was this lousy title!

  • Members
  • 11 posts

Posted 19 February 2011 - 02:06 PM

My two cents...

EAGI() dialplan application allows call audio signal to be passed into AGI script. My idea is to do the following:

* Configure the payphone extension in batphone mode - that is, as soon as someone picks it up, the Asterisk calls, say extension 1337.
* When extension 1337 receives a call, is runs callbouncer.pl or something via EAGI() application. Call audio, as well as AGI signalling inpho is available to this script.
* callbouncer.pl contains digital signal processing code to detect ACTS/redbox tones. If these tones are detected, it allows one to dial out and talk for pre-configured amount of time.

Edited by Mr. X, 19 February 2011 - 02:06 PM.





BinRev is hosted by the great people at Lunarpages!