460 likes | 558 Views
Welcome! Today’s Webinar: Designing VoIP Services with PIKA Building Blocks. Irene Crosby Head of Marketing PIKA Technologies. Your Webinar Leader. Yashar Moghan Senior Field Application Engineer PIKA Technologies. Familiarization with MShow. Audio streaming Sending us questions.
E N D
Welcome! Today’s Webinar: Designing VoIP Services with PIKA Building Blocks • Irene Crosby • Head of Marketing • PIKA Technologies
Your Webinar Leader • Yashar Moghan • Senior Field Application Engineer • PIKA Technologies
Familiarization with MShow • Audio streaming • Sending us questions
Objectives To present: • A technical overview of PIKA VoIP building blocks, and • How to develop VoIP-enabled applications using a PIKA platform
Agenda • An overview of general requirements for IP-PSTN connectivity • VoIP building blocks in MonteCarlo 6.2 • G.711 and 726 codecs, RTP, jitter buffer, EC • PIKA VoIP and related API • Integration with VoIP signaling stacks • Hardware requirements: • PIKA MM cards plus any host NIC • Setup tool, test and sample applications
Assumptions • You have a basic technical understanding of IP / VoIP • Ideally, you are familiar with PIKA MonteCarlo
RTP RTP 001010 RTP 0010101010 RTP 001010 RTP RTP 0010101010 Jitter Buffer General requirements for IP-PSTN connectivity PSTN/POTS PIKA APPLICATION IP Codec 01001001010101001110101 IP SIP Echo 1101110101 Codec
Essential building blocks in MonteCarlo 6.2 • Readily supported IP codecs G.711, G.726 • RTP Packet headers containing codec type and ordering info • Jitter buffer Uses RTP information to deliver smoother /steady audio • Echo cancellation All done on the DSP
Essential building blocks in MC6.2 • IP codecs • Format of Tx/Rx compressed data/audio • Compressed data = Payload • G.711 and G.726 formats are offered readily • Other codecs would be considered as needed
Essential building blocks in MC6.2 • RTP (Real-Time Transport Protocol) • Serves as a mechanism to tell the receiving-end the format of the audio • Provides information to the receiving-end to put the packets in the correct order or skip missing ones • [RTP header + Payload] => RTP IP packet
Essential building blocks in MC6.2 • Jitter buffer mechanism • Why needed: VoIP packets do not necessarily arrive at their destination in correct order, or at all! • An adjustable buffer with parameters set in the API structure; i.e. size, dynamic vs. static • Takes advantage of RTP information associated with each packet to order them correctly before delivering the audio to the near-end listener
Essential building blocks in MC6.2 • Echo Cancellation • Due to inherent delay in VoIP systems, echo is more noticeable than in regular PSTN calls. It must be removed in most cases! • G.168 compliant • Tail lengths from 1 to 128ms • EC mask is simply added to resMask when seizing the RTP resource
VoIP API • PK_VOIP_EncodeSetParameters • PK_VOIP_EncodeGetBufferSize • PK_VOIP_EncodeAddBuffers • PK_VOIP_EncodeStart • PK_VOIP_EncodeStop • PK_VOIP_DecodeSetParameters • PK_VOIP_DecodeGetBufferSize • PK_VOIP_DecodeStart • PK_VOIP_DecodeAddBuffers • PK_VOIP_DecodeStop
VoIP API – Encode – SetParameters • PK_VOIP_EncodeSetParameters (TResourceHandle hPort,TVOIPEncodeParameters *encodeParams); typedef struct{ TCodecType codecType; PK_U32 payloadType; PK_U32 packetizationRate; <keep default 2> PK_BOOL vadEnabled; } TVOIPEncodeParameters;
VoIP API – Encode – codecType • PK_VOIP_EncodeSetParameters( ) Codec Types typedef enum{ PK_PCMU = 0, PK_PCMA = 1, PK_G726_16 = 4, PK_G726_24 = 5, PK_G726_32 = 6, PK_G726_40 = 7 } TCodecType;
VoIP API – Encode – payloadType • PK_VOIP_EncodeSetParameters( ) Payload Type Codec Payload Type G.711 µ-law 0 G.711 A-law 8 G.726 2 / dynamic For details see: www.ietf.org/rfc/rfc3551.txt
VoIP API – Encode – GetBufferSize • PK_VOIP_EncodeGetBufferSize (TResourceHandle hPort); • Must be called after SetParameters but before AddBuffer • Returns the recommended size of the buffer (in bytes) • e.g. if G.711, packetization 2: required RTP buffer size returned is 172 bytes (12 bytes RTP header + 2 x 80 bytes payload) • Used to allocate memory for the buffer (.lpData) • Used to set the length of the buffer (.dwBufferLength) [See Page 202 of Programmer’s Guide]
VoIP API – Encode – AddBuffer • PK_VOIP_EncodeAddBuffer (TResourceHandle hPort, TBufferHeader *pBuffer); • Called after EncodeGetBufferSize but before EncodeStart • The buffer passed-in must at least be as large as the buffer size returned by PK_VOIP_EncodeGetBufferSize • The buffer is returned to the application once it is filled (by RTP encoding, hport).
VoIP API – Encode – Start • PK_VOIP_EncodeStart (TResourceHandle hPort); • Called after EncodeAddBuffer • Starts RTP encoding process on DSP port, hPort • Encoded RTP packets are returned to application via installed ‘event handler’ (of hport) and indicated by event PK_EVENT_VOIP_ENCODE_RETURN_PACKET • The packet is now ready for transmission over the host network interface
VoIP API – Encode – Stop • PK_VOIP_EncodeStop (TResourceHandle hPort); • Called after Encodestop • Stops an RTP encoding operation on the DSP port specified by hPort • Used when the VoIP call terminates
Related API – called before VoIP API • PK_DSP_GetDeviceHandle • PK_DSP_DEVICE_SeizePort • PK_DSP_PORT_SetEventHandle • PK_CTBUS_FullDuplexConnect //Line Port DSP Port
Related API – SeizePort (DSP) • PK_DSP_DEVICE_SeizePort (TDeviceHandle hDsp, TResourceMask resMask ); Example: resMask =PK_RTP|PK_G711|PK_ECHO_CANCELLATION
VoIP API • PK_VOIP_EncodeSetParameters • PK_VOIP_EncodeGetBufferSize • PK_VOIP_EncodeAddBuffers • PK_VOIP_EncodeStart • PK_VOIP_EncodeStop • PK_VOIP_DecodeSetParameters • PK_VOIP_DecodeGetBufferSize • PK_VOIP_DecodeStart • PK_VOIP_DecodeAddBuffers • PK_VOIP_DecodeStop
VoIP API – Decode – SetParameters • PK_VOIP_DecodeSetParameters (TResourceHandle hPort, TVOIPDecodeParameters *decodeParams); typedef struct{ TCodecType codecType; PK_U32 payloadType; PK_U32 initialLatencyInFrames; //default 3 PK_BOOL dynamicJitterBufferEnabled; //TRUE or FALSE PK_U32 jitterBufferPeriod; //default 640ms PK_U32 fixedLatencyInFrames; //1-11 } TVOIPDecodeParameters;
VoIP API – Decode – initialLatencyInFrames • PK_VOIP_DecodeSetParameters( ) initialLatencyInFrames: • Indicates number of frames that will be placed in the jitter buffer before starting the RTP decoder • Suggested/default value is 3 • 0 or 1 will have the RTP receiver start the decoder as soon as an RTP packet is received
VoIP API – Decode – dynamicJitterBufferEnabled • PK_VOIP_DecodeSetParameters( ) dynamicJitterBufferEnabled: • Set as PK_TRUE or PK_FALSE • RTP process will manage the number of frames to put in the jitter buffer by analyzing the packets received • After the jitterBufferPeriod is expired, the number of “initial frames” in the jitter buffer may change based on timing of the packets received
VoIP API – Decode – jitterBufferPeriod • PK_VOIP_DecodeSetParameters( ) jitterBufferPeriod: • Defines how often the RTP receiver manages the jitter buffer in number of 10 milliseconds • Default value is 640 ms
VoIP API – Decode – fixedLatencyInFrames • PK_VOIP_DecodeSetParameters( ) fixedLatencyInFrames: • Identifies the fixed number of frames to be stored in the jitter buffer • 1 is the minimum, 11 is the maximum value for this parameter • Applied when dynamicJitterBufferEnabled is set to PK_FALSE
VoIP API – Decode – SetParameters - Example TVOIPDecodeParameters VOIPDecodeParameters ; VOIPDecodeParameters.codecType = PK_PCMU; VOIPDecodeParameters.payloadType = 0; VOIPDecodeParameters.initialLatencyInFrames = PK_VOIP_INITIAL_LATENCY_DEFAULT; // 3 (frames) VOIPDecodeParameters.dynamicJitterBufferEnabled = PK_TRUE; VOIPDecodeParameters.jitterBufferPeriod = PK_VOIP_JITTER_BUFFER_PERIOD_DEFAULT; // 64 (640ms) VOIPDecodeParameters.fixedLatencyInFrames = 0; PK_VOIP_DecodeSetParameters ( hDSPPort, &VOIPDecodeParameters );
VoIP API – Decode – GetBufferSize • PK_VOIP_DecodeGetBufferSize( ) • Provided for consistency with Encode • Returned value is calculated based on the size of RTP header and the maximum allowed payload (200 ms) • Application may allocate smaller buffers if the worst case is known for the expected number of frames per RTP packet
Important notes: • DSP port seized for VoIP streaming can perform both encode and decode simultaneously; i.e. one DSP port per VoIP session • For encode: add ~15 buffers before calling PK_VOIP_EncodeStart • For decode: use of only one buffer is sufficient; to be added after calling PK_VOIP_DecodeStart (once filled with an incoming packet)
Related API – Echo Cancellation • PK_DSP_DEVICE_SeizePort(hDSPDevice , PK_ECHO_REFERENCE); • PK_CTBUS_HalfDuplexConnect(hDSPPort , hDSPPortER); • PK_EC_Initialize(hDSPPort , hDSPPortER , 12); //last parm Tail Length • PK_EC_Enable(hDSPPort);
Integration with VoIP signaling stacks • No restriction on use of any stack due to low-level, modular and flexible VoIP API • Sample integration with SIP is available • Customers have done integration withH.323, MS SIP, oSIP, Vovida • MonteCarlo 6.3 to provide an embedded SIP stack as well
PIKA board support and other hardware requirements • All PIKA board types support VoIP • PrimeNet MM (E1/T1), Daytona MM (LS/POTS), InLine MM (LS) • DSP-based, common to all boards • Host NIC used for IP connection
Test application • PikaTest.exe • Part of MonteCarlo 6.2 installation, under PIKA Bin folder • General multi-purpose application • Command-line based
Test/sample applications • VoIP_Sample_DMM • Demonstrates use of VoIP API in a focused manner • No signaling stack integration • Easy setup, requires one DMM POTS only • VoIP audio streaming between two phones on DMM • Echo cancellation enabled • Available online under Downloads Sample Code
Test/sample applications • SIP Demo v0.5 • Much larger application, includes SIP integration • Able to register the system (i.e., a VoIP client) with a publicly available or private SIP proxy • Full ‘call’ support; including invite, trying and bye messages • Can place VoIP calls between two PIKA-based systems (VoIP clients) or to a SIP phone • Verified under numerous SIP proxies • Online under Downloads Sample Code
SIP Proxy SIP demo configuration ext. 450 PSTN WORLD GrandStream VoIP phone SIP Server 1 SIP Server 2 SIP Stack + MC 6.2 NIC SIP Stack + MC 6.2 NIC Daytona Daytona External line (591-0000) Telephony Switch ext. 441 ext. 442 PIKA WORLD Any phone
Thank You • If you are interested in taking a closer look, download our Programmer’s Guide: • http://www.pikatechnologies.com/downloads/software.htm • Additional HW info is available from: • http://www.pikatechnologies.com/downloads/hardware.htm • If you want to speak to the sales account manager in your region, a field application engineer, or technical support, the next slide has their contact information…
How to reach our people • Sales • Western USA – Brett Sumpter phone: +1-903-939-3711 • Eastern USA – Cheryl Farmer phone: +1-770-345-5944 • EMEA – Maarten Kronenburg phone: +31 76 5083 560 • Canada, Americas & Asia – Terry Atwood phone: +1-613-591-1555 x329 • Field Application Engineers • Yashar Moghan – phone: +1-613-591-1555 x415 • Cindy Xu – phone: +1-613-591-1555 x458 • Technical Support • support@pikatech.com • Phone: +1-613-591-1555 x216