PDA

View Full Version : How do I use PIKA Digital T1 HMP card in Clear Channel mode?



epretlac
05-01-09, 03:01 PM
Solution:

There’s really nothing special to be done to configure for clear channel mode. If you were developing an ISDN application you would call PKH_ISDN_GetConfig / PKH_ISDN_SetConfig (followed by PKH_ISDN_Start). Not calling them leaves the card in clear channel mode.

This script below demonstrates how to play DTMF tones and an audio file in clear channel mode. The script below assumes that span 0 is connected to a T1 line.

# aohtest

> log set masks api=0xffffffff
> system 0 open
> board 0 open
> span 0 open
> channel 0 seize
> span 0 start
// wait a few seconds for the SPAN_ALARM_T1 events to clear
> tg 0 playdtmf 123
> play 0 start /usr/bin/jingle.au
// this audio file is about 30 seconds long

The output should look similar to this...

May 1 14:33:55.127:
May 1 14:33:55.128: ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++
May 1 14:33:55.128: aohtest 2.7.1.4
May 1 14:33:55.128: Comment: Standard Build
May 1 14:33:55.128: Compile date: Feb 23 2009 16:42:30
May 1 14:33:55.128: Copyright (c) 2009 PIKA Technologies Inc.
May 1 14:33:55.128:
May 1 14:33:55.128: type 'help' for the list of supported functions
May 1 14:33:55.128: ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++

May 1 14:34:04.475: > log set masks api=0xffffffff
May 1 14:34:04.487: > system 0 open
May 1 14:34:04.488: > board 0 open
May 1 14:34:04.489: > span 0-1 open
May 1 14:34:04.504: > channel 0 seize
May 1 14:34:04.504: > span 0-1 start
May 1 14:34:04.504: SPAN 0: received PKH_EVENT_SPAN_ALARM_T1_RED (p0 = 0x1, p1 = 0x0, p2 = 0x0)
May 1 14:34:04.505: SPAN 1: received PKH_EVENT_SPAN_ALARM_T1_RED (p0 = 0x1, p1 = 0x0, p2 = 0x0)
May 1 14:34:04.954: SPAN 1: received PKH_EVENT_SPAN_ALARM_T1_YELLOW (p0 = 0x3, p1 = 0x0, p2 = 0x0)
May 1 14:34:04.957: SPAN 0: received PKH_EVENT_SPAN_ALARM_T1_YELLOW (p0 = 0x3, p1 = 0x0, p2 = 0x0)
May 1 14:34:19.813: SPAN 0: received PKH_EVENT_SPAN_ALARM_T1_RED_CLEAR (p0 = 0x2, p1 = 0x0, p2 = 0x0)
May 1 14:34:19.814: SPAN 1: received PKH_EVENT_SPAN_ALARM_T1_RED_CLEAR (p0 = 0x2, p1 = 0x0, p2 = 0x0)
May 1 14:34:20.192: SPAN 1: received PKH_EVENT_SPAN_ALARM_T1_YELLOW_CLEAR (p0 = 0x0, p1 = 0x0, p2 = 0x0)
May 1 14:34:20.195: SPAN 0: received PKH_EVENT_SPAN_ALARM_T1_YELLOW_CLEAR (p0 = 0x0, p1 = 0x0, p2 = 0x0)
May 1 14:34:35.087: > tg 0 playdtmf 123
May 1 14:34:35.234: TG 0: received PKH_EVENT_TG_TONE_PLAYED (p0 = 0x1, p1 = 0x2, p2 = 0x0)
May 1 14:34:35.401: TG 0: received PKH_EVENT_TG_TONE_PLAYED (p0 = 0x2, p1 = 0x1, p2 = 0x0)
May 1 14:34:35.569: TG 0: received PKH_EVENT_TG_TONE_PLAYED (p0 = 0x3, p1 = 0x0, p2 = 0x0)
May 1 14:34:46.423: > play 0 start /usr/bin/jingle.au
May 1 14:35:19.224: PLAY 0: received PKH_EVENT_PLAY_IDLE (p0 = 0x400dd, p1 = 0x0, p2 = 0x0)

Each command above is basically a wrapper for a function in the API Reference manual.

The first command above turns on API logging. Logs will be generated in /var/log/pika/aoh_<latest-date-and-time>. The logs will show you exactly which HMP API calls were made by aohtest.

Note that aohtest hides a couple of functions under the covers. For example, before playing media (tones or audio files) on a span, your application will need to call the function PKH_SPAN_GetMediaStreams(). The aohtest application calls that function when it calls the ‘tg’ command. All API function calls will be seen in the log files.

When you’re ready to start developing your application, I would recommend that you check out our sample code at the link below.
http://www.pikatechnologies.com/english/View.asp?mp=804&x=801

Hopefully that information will get you started.

Eric Pretlac
Technical Support Specialist
PIKA Technologies, Inc.