vTsp_1_3_1_Root

214
The Leader in Embedded VoIP Software

Transcript of vTsp_1_3_1_Root

Page 1: vTsp_1_3_1_Root

The Leader in

Embedded VoIP Software

Page 2: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 2

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

Q&A

Page 3: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 3

What is VoIP

PSTN Central Office SIP Server on Computer

Page 4: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 4

VoIP Configuration with vport_cfg.txt

sipluport 5060

sipdomain 172.16.0.173

sipproxy sip:172.16.0.173

sipregis sip:172.16.0.173

siprealm 3CXPhoneSystem

regtime 3600

dname00 102

uname00 102

authname0 102

authpass0 102

rtpport 11000

t711a 8

t721 2

t729 18

tcn 0

tdtmfr 101

prefcoder 18

region us

1: IP Address

2: Username and Password

1: Codec

SIP Server

vport_cfg.txt

Page 5: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 5

The further explanation is in

vPort_1_3_0_Configuration_Interface.pdf

Page 6: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 6

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

Q&A

Page 7: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 7

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FXS

FXO

SPKR/MIC

vPort Architecture

Page 8: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 8

vApp Architecture

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FXS

FXO

SPKR/MIC

FSM

GUI vport_cfg.txt

Next

Topic

Page 9: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 9

Step by Step in vapp_init.c vint VAPP_main(…)

{

….

if (OSAL_FAIL == OSAL_init()) {

….

}

….

if (VAPP_OK != _VAPP_initSetupSystem(…)) {

….

}

….

if (VAPP_OK != VAPP_vtspStart(…)) {

….

}

….

if (VAPP_OK != VAPP_mgmtInit(…)) {

….

}

….

if (VAPP_OK != VAPP_sipStart(…)) {

….

}

….

if (VAPP_OK != _VAPP_initCreateQueues(…)) {

….

}

….

if (VAPP_OK != _VAPP_initStartTasks(…)) {

….

}

….

}

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FSM

GUI vport_cfg.txt

VAPP_vtspEventsTask VAPP_sipNetworkInterfaceTask VAPP_sipErrorHandlerTask

VAPP_sipUaHandlerTask

VAPP_sipUaHandlerTask

VAPP_sipUaHandlerTask

….

Page 10: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 10

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

Q&A

Page 11: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 11

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 12: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 12

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation LayerAudio/Telephone

Interface Driver

IP Stack, NAT

O/S

Soc Processor

D2 Supplied

Cavium Supplied

Licensed to Cavium

FXS

FXO

SPKR/MIC

vPort Architecture Key

Page 13: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 13

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 14: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 14

From analog signal to PCM digital code

Codec

Page 15: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 15

Pulse Modulation: Three Style

• Pulse Amplitude Modulation (PAM)

t Ts

A PAM Td

PTM T

PWM

•Pulse Time Modulation (PTM)

•Pulse Width Modulation (PWM)

• Pulse Amplitude Modulation (PAM)

Page 16: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 16

Pulse Amplitude Modulation:

example

Page 17: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 17

Pulse Amplitude Modulation can not

work alone in data communication.

However, it has to work with another

conversion method called

Pulse Code Modulation.

Note:

Page 18: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 18

From analog signal to PCM digital code

Codec

Page 19: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 19

Pulse Code Modulation (PCM):

Quantized PAM signal

Page 20: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 20

Pulse Code Modulation (PCM):

Quantizing by using sign and magnitude

Page 21: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 21

Pulse Code Modulation (PCM): Quantized PAM signal by using sign and magnitude

Page 22: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 22

Note:

An international standard with the following feature is called G.711

1: for encoding telephone audio on a 64 kbps channel.

2: It is a pulse code modulation (PCM) scheme

3: operating at a 8 kHz sample rate, with 8 bits per sample

Page 23: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 23

Applicable when the signal is in a finite

range (fmin,fmax)

The entire data range is divided into L

equal intervals of length Q (known as

quantization interval or quantization

step-size)

Q = (fmax - fmin) / L

Interval i is mapped to the middle value

of this interval

We store / send only the index of

quantized value

Index of quantized value = Q i (f) = Low bound [ (f – f min) / Q ]

Quantized value = Q(f) = Q i (f) * Q + Q / 2 + fmin

Uniform Quantization

Page 24: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 24

Example of uniform Quantization

1.2

-0.2

-0.5

0.4

0.89

1.3

time 0

0.75

1.5

-0.75

-1.5

amplitude For the following sequence

{1.2,-0.2,-0.5,0.4,0.89,1.3…},

Quantize it using a uniform quantizer

in the range of (-1.5,1.5) with 4 levels,

and write the quantized sequence.

Solution: Q=3/4=0.75. Quantizer is illustrated above.

1.2 fall between 0.75 and 1.5, and hence is quantized to 1.125

Quantized sequence: ={1.125,-0.375,-0.375,0.375,1.125,1.125}

1.125

0.375

-0.375

-1.125

Quantized

Values

Page 25: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 25

Problems with uniform quantization

Problems with uniform quantization

It is only optimal for uniformly distributed signal

Real audio signals (speech and music) are more

concentrated near zero axis which is not

uniformly distributed

Solution (To address this issue, we could use

another technique)

Using non-uniform quantization

quantization interval is denser near zero axis

Page 26: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 26

Pulse Code Modulation (PCM):

Style of Quantization

Uniform in amplitude compression

As previous example

Non-Uniform in amplitude compression

Next topic

PCM μ-Law PCM A-Law

Non-Uniform : Logarithmic Quantization, Signal Amplitude versus

Quantization Value

Uniform : Linear Quantization, Signal Amplitude versus Quantization

Value

PCM linear G.711 G.711 G.711 G.711μ-Law

Page 27: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 27

Input-Output relations for a μ-law

characteristic

• The u is zero is straight line , when the number goes up, the curvature becomes larger

Page 28: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 28

µ-law compressor

The formula for the µ-law compressor is

where µ is the µ-law parameter of the compressor,

log is the natural logarithm,

and sign(x) = x / abs(x)

Page 29: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 29

µ-law expander

The formula for the µ-law expander, shown below, is the inverse of the compressor function.

The input can have any shape or frame status. This block processes each vector element independently

Page 30: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 30

Example of non-uniform Quantization

0

0.75

1.5

-0.75

-1.5

1.125

0.375

-0.375

-1.125

1.2

-0.2

-0.5

0.4

0.89

1.3

time

Question:

For the following sequence

{1.2,-0.2,-0.5,0.4,0.89,1.3…},

Quantize it using a μ-Law quantizer

in the range of (-1.5,1.5) with 4 levels,

and write the quantized sequence.

Solution:

To apply the inverse formula to obtain the new quantized value based

on previous uniform sample.

Because the mu-law mapping is symmetric,

we only need to find the inverse values for y=0.375,0.75,1.125

μ =9, x_max=1.5, 0.3750.1297, 0.750.3604, 1.1250.7706

Quantized sequence:= {0.77,-0.13,-0.77,0.77,0.77,0.77}

0.3604

1.5

-0.3604

-1.5

0.7706

0.1297 -0.1297

-0.7706

Quantized

value

• Value axis

Page 31: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 31

From analog signal to PCM digital code

Codec

Page 32: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 32

Binary Encoding

Convert each quantized level index into a

codeword consisting of binary bits

Ex: natural binary encoding for 8 levels:

– 000,001,010,011,100,101,110,111

Page 33: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 33

Example 1: uniform quantizer

1.2

-0.2

-0.5

0.4

0.89

1.3

time 0

0.75

1.5

-0.75

-1.5

amplitude

00

01

10

11

Code

words For the following sequence

{1.2,-0.2,-0.5,0.4,0.89,1.3…},

Quantize it using a uniform quantizer

in the range of (-1.5,1.5) with 4 levels,

and write the quantized sequence.

and the corresponding binary bitstream.

Solution: Q=3/4=0.75. Quantizer is illustrated above.

Codewords: 4 levels can be represented by 2 bits, 00, 01, 10, 11

• Quantized value sequence:

{1.125,-0.375,-0.375,0.375,1.125,1.125}

• Bitstream representing quantized sequence:

{11, 01, 01, 10, 11, 11}

1.125

0.375

-0.375

-1.125

Quantized

values

Page 34: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 34

Example 2: non-uniform quantizer

00

01 10

11

Code

words For the following sequence

{1.2,-0.2,-0.5,0.4,0.89,1.3…},

Quantize it using a μ-Law quantizer

in the range of (-1.5,1.5) with 4 levels,

and write the quantized sequence.

and the corresponding binary bitstream.

Solution: Q=3/4=0.75. Quantizer is illustrated above.

Codewords: 4 levels can be represented by 2 bits, 00, 01, 10, 11

Original sequence: {1.2,-0.2,-0.5,0.4,0.89,1.3…}

Quantized sequence: {0.77,-0.13,-0.77,0.77,0.77,0.77}

Bitstream: {11,01,00,11,11,11}

1.2

-0.2

-0.5

0.4

0.89

1.3

time

Quantized

values

0.7706

0.1297 -0.1297

-0.7706

0.3604

1.5

-0.3604

-1.5

amplitude

Page 35: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 35

Note:

How fast do you have to sample an input source to

get a fairly accurate representation?

Nyquist’s law: sample rate = bandwidth * 2

Thus, if you want to digitize voice (4000 Hz), you

need to sample at 8000 samples per second

Page 36: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 36

Question

We want to digitize the human voice. What is the bit rate,

assuming 8 bits per sample?

Solution

The human voice normally contains frequencies from 0 to

4000 Hz.

Sampling rate = 4000 x 2 = 8000 samples/s

Bit rate = sampling rate x number of bits per sample

= 8000 x 8 = 64,000 bps = 64 Kbps

Page 37: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 37

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 38: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 38

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise Floor

Estimator

Near end Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32K

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

sound

Data path from phone to network

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32K

G729_AB

Encoder PCM

Linear signal

PCM

μ-Law Signal

Analog

Signal

Clear signal CN found

and CN enabled

P

L

C

Noise Floor Estimator

Far end

DTMF found and

DTMF Relay

enabled

Page 39: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 39

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 40: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 40

Voice Signal Processing

Echo Cancellation

DTMF Detector

Noise Floor Estimator

Page 41: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 41

Echo Canceller Configuration

Far End Near End

Echo

Paths

+

Echo

Canceller

Receive input signal

Signal after cancellation

Echo

Estimator

Echo

Canceller

Non-Linear

Processor

Filtered

Signal

Clear

Signal e(n)

Reference Signal y(n)

Input Signal x(n)

Page 42: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 42

Operation of Echo Canceller

Echo

Estimator

Echo

Canceller

Non-Linear

Processor

voice

Signal

Reference Signal y(n)

Input Signal x(n)

1: Build a model or characterization of the voice signal

Signal with echo

2: Compare reference signal with result of step 1,

found the echo and inform Echo Canceller

3: Echo canceller eliminate (subtract) echo on Input

Signal according to result of step 1

5: go to step 1

Filtered

Signal

Input Signal x(n)

4: NLP eliminate the remaining echo by attenuating the

signal below the noise floor

Clear Signal

Page 43: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 43

Echo Cancellation in vTSP could

eliminate 16 ms echo.

Note:

The purpose of echo canceller is to eliminate Echo in order to give a clear single to Peer,

If you hear Echo, That is to say the far-end do not perform Echo Cancellation well

Page 44: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 44

Basic Block Diagram of NLP

Level

Detector Gain Control

Input

Output

Level detector found the

amplify of input is above

the threshold

Gain Controller Turn

On

The input which above the

threshold will be kept

Page 45: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 45

Function of NLP (Non Linear Processor)

1: To removes all signals (residual echo) by attenuating the signal below a certain threshold (noise floor)

2: To replaces them with simulated background

noise which sounds like the original background

noise without the echo.

Page 46: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 46

Voice Signal Processing

Echo Cancellation

DTMF Detector

Noise Floor Estimator

Page 47: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 47

Characteristic of DTMF

(dual tone multi frequency )

Above is frequencies for the DTMF digits that must be detected

With DTMF, each key you press on your phone generates

dual tones at the same time based on the following

specific frequencies.

one tone is generated from a high frequency group of

tones and the other from a low frequency group

So that a voice can't simulate the tones.

Page 48: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 48

figure: DTMF for digit 1

DTMF

Detector DTMF Relay Encode

(RFC 2833)

DTMF Detector

analyze the

data with length

of 5ms

DTMF Detector found the

input data meet the

characteristic of DTMF

digit - 1

DTMF Detect the leading edge in 35

ms and issue an event to indicate the

Button Press

DTMF Detect the falling edge in 25

ms and issue an event to indicate the

Button Release

The Operation of DTMF Detector

Minimum allowed power

is -45 to -25 dBm

Must accept / Must reject

frequency tolerances

( +-2.5 to +-3.5 % )

Page 49: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 49

Voice Signal Processing

Echo Cancellation

DTMF Detector

Noise Floor Estimator

Page 50: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 50

Noise Floor Estimator

Function:

Dynamically estimate background noise level

Calculate and maintain energy histories of

various input signals

Calculate the noise floor estimate in dBm

Configuration:

MAX noise floor is -35 dBm

MIN noise floor is -60 dBm

Handled voice size is 10ms

Page 51: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 51

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Estimator Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

sound

Data path from phone to IP

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Encoder PCM

Linear signal

PCM

μ-Law Signal

Analog

Signal

Clear signal

Clear / mixed

signal

Compressed

Voice data /

inband Tone

Out-band

DTMF packet

RFC 2833

Comfortable

Noise packet DTMF found and

DTMF Relay

enabled

CN found

and CN enabled

RTP Packet

FIFO Queue

for RTP with

size of 10

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end

Page 52: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 52

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 53: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 53

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Estimator Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

Data path from IP to speaker

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Encoder

Jitter Buffer with

200ms size

Topic for next slide

Jitter

Buffer

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end

Page 54: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 54

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 55: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 55

Arrival Packet situation 1: Jitter

Jitter

variability in the arrival rate of data is called jitter

Hi How are you

Hi Ho ...w are you

Jitter

sender

receive

Page 56: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 56

Solution 1: Dynamic adaptive Jitter Buffer

Jitter buffer

Hi How are you

Hi Ho ...w are you

Jitter

sender

receive

Hi How are you< 150 ~

200 ms

Jitter buffer/ Smoother

playback

Page 57: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 57

Jitter (Delay Variation)

0

100

200

300

400

500

600

Pe

rfe

ct

Ex

ce

lle

nt

Go

od

Ac

ce

pta

ble

An

no

yin

g

Ba

d

Un

us

ab

le

millis

ec

on

ds

G.711

Intranet

Internet

Page 58: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 58

ITU G.114 states

one-way delay <= 150 msec ~200 msec

is acceptable.

Note:

Observation:

If the jitter buffer size is too large, round trip delay will increase, But if buffer size is less than inter-packet delay, then we can’t solve delay problem

Page 59: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 59

Hi How are you

Hi Ho ...a wre you

Out of

sequence

sender

receive

Arrival Packet situation 2: Out of Sequence

Page 60: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 60

Solution 2: Drop it

The business of voice decode could not being

inversed

So, Just drop the Out of Sequence packet that

behind 200ms

Hi How are you

Hi Ho .... are you

Out of

Sequence

sender

receive

200ms

Page 61: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 61

Hi How are you

Hi Ho .... are you

Packet lost

sender

receive

Arrival Packet situation 3: Packet lost

Page 62: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 62

Voice QoS - Packet Lost

0%

5%

10%

15%

20%

25%

30%

35%

40%

45%

Perf

ect

Excell

en

t

Go

od

Accep

tab

le

An

no

yin

g

Bad

Un

usab

le

G.711

G.723.1Internet Intranet

Page 63: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 63

Well Known mechanism for PLC

1: Repeat the contents of previous packet

2: Generate background noise

3: Generate average value from previous and next packet

4: Forecast the contents of packet

Efficient for small voice packet (< 16ms)

Page 64: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 64

Operation of Packet Lost Compensation

Bad Packet

Detector Generate Packet

Input replace

Output PLC Functional diagram

1: Bad packet found at series number N

2: Generate the first comfortable noise packet for step1’s result

3: Generate the second comfortable noise packet according to packet that series number is N + 1

4: replace packet that series number is N with first comfortable noise packet

5: replace packet that series number is N + 1 with second comfortable packet

Page 65: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 65

Example of Packet Lost Compensation

Bad Packet

Detector Generate Packet

Input replace

Output

Being attenuated at

0.4dB/ms (adjustable)

to a noise floor

Being deattenuated back

to the original level at 0.8

dB/ms (adjustable)

This is an example of the working

of PLC. This shows a 1Khz

Tone at -15 dB being

attenuated at 0.4dB/ms to a

noise floor of -45dB, and then

deattenuated back to the

original level at 0.8 dB/ms.

PLC Functional diagram

Page 66: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 66

Performance of PLC

Page 67: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 67

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Estimator Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

Data path from IP to speaker

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Encoder

Encoder is one of the

following: G.711 A-law,

G.711 μ -law, G.726_32,

G.729_AB

Encoder is DTMF

Encoder is

Comfortable Noise PCM

Linear signal

PCM

μ-Law Signal

Jitter Buffer with

200ms size

Single / Mixed

signal

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end

Page 68: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 68

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Estimator Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

sound

Data path from phone to network and

from network to phone

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Encoder PCM

Linear signal

PCM

μ-Law Signal

Analog

Signal

Clear signal

Clear / mixed

signal

Compressed

Voice data /

inband Tone

Out-band

DTMF packet

RFC 2833

Comfortable

Noise packet DTMF found and

DTMF Relay

enabled

CN found

and CN enabled

RTP Packet

FIFO Queue

for RTP with

size of 10

PCM

Linear signal

PCM

μ-Law Signal

Jitter Buffer with

200ms size

Single / Mixed

signal

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end Encoder is DTMF

Encoder is

Comfortable Noise

Encoder is one of the

following: G.711 A-law,

G.711 μ -law, G.726_32,

G.729_AB

Page 69: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 69

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 70: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 70

Type I Caller ID Requirement

Preamble

250 msec

30 Bytes

> 600 Hz

0101010101

Data

Data

Month – Day – Hour - Minute

Phone Number

Ring Pattern Ring Pattern

FSK Modulation 2.9 – 3.7 s

Data Count

8 bits

Message Type

8 bits

(Signal or multiple

Message format)

CheckSum

8 bits

45 ms ~ 500 ms

200 ms ~ 500 ms

Mark Bits

Typically 180 Bits

(150 ms)

3.9 – 4.7 s

Mark Off

2 s 2 s

Bit Stuffing

0 – 100 mark bits

On Hook

To get the

CPE’s

attention

Page 71: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 71

Type II Caller ID with Call Waiting

Requirement

Off Hook

Subscribe Alert Signal (“ Call Waiting Beep ”) 440 Hz, 500 ms

ACK via DTMF A or DTMF D

FSK Data

Phone

Switch

CAS (Customer Premise Equipment Alert Signal) 80 ms

Within 50 ms

CPE Keep mute

for 500 ms

Page 72: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 72

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 73: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 73

V

Linux

IP Stack

Soc Processor

kmalloc

Application L

ve_osal_kernel

V

vxworks

IP Stack

malloc

Application V

Problem:

Application depend on API that O.S. provided

Solution:

Create a new layer to gather ALL API that O.S.

provided

Drawback:

1: Application will have many version due to O.S.

2: Application need to update according to new

API of O.S.

3: need more effort to remember the usage of

API that O.S. provided

Page 74: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 74

Linux

IP Stack

Soc Processor

OSAL_memAlloc(…)

Application

vXworks

IP Stack

void *OSAL_memAlloc(...)

{

....

retBuf = (void *) kmalloc(...);

}

void *OSAL_memAlloc(...)

{

....

retBuf = (void *) malloc(...);

}

OSAL for Linux OSAL vxworks

ve_osal_kernel

Observation:

Application do not depend on API

that O.S. provided

Advantage:

1: Application will have only one

version

2: Application do not need to update

according to new API of O.S.

3: Just need to remember the usage

of API that O.S.A.L provided

Page 75: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 75

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 76: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 76

vTSP initialization Step to launch vTSP Explanation

VTSP_init(&VTSP_ptr, NULL, &taskConfig );

Prototype: VTSP_Return VTSP_init(

VTSP_Context **contecxt_ptr,

VTSP_ProfileHandler *profile_ptr

VTSP_TaskConfig *taskConfig_ptr );

Purpose: Initial vTSP with TaskConfig and go to sleeping mode

Return value: VTSP_OK , VTSP_E_SHUTDOWN

Step 3:

This is a point to vTSP Object Step 2:

typedef void *VTSP_Context;

typrdef struct {

vint vTSPAddStackSize;

vint rtcpAddStackSize;

uint16 rtcpInternalPort;

vint cidFormat;

} VTSP_TaskConfig;

Application – owned VTSP_TaskConfig structure.

This structure is used to initialize vTSP

cidCountryCode could be the following:

VTSP_TEMPL_CID_FORMAT_US,

VTSP_TEMPL_CID_FORMAT_JP,

VTSP_TEMPL_CID_FORMAT_UK_FSK,

VTSP_TEMPL_CID_FORMAT_UK_DTMF

Step 1:

VTSP_start( );

Prototype: VTSP_Return VTSP_start( void );

Purpose: To wake up vtsp, enable interrupts from the telephony

hardware and begin event message generation

Return value: VTSP_OK , VTSP_E_INIT, VTSP_E_HW,

VTSP_E_CONFIG

Step 4:

Page 77: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 77

Code Example: VTSP_init

VTSP_Context VTSP_ptr = NULL;

VTSP_TaskConfig taskConfig;

taskConfig.rtcpInternalPort = htons(2049);

taskConfig. cidFormat = VTSP_TEMPL_CID_FORMAT_US;

If (VTSP_OK != VTSP_init(&VTSP_ptr,NULL,&taskConfig))

{

printf(“\n Initianlize vTSP fail”);

return -1;

}

If (VTSP_OK != VTSP_start())

{

printf(“\n vTSP start fail ”);

return -1;

}

Page 78: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 78

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

ve_gpl_osal_kernel.ko

ve_vtsp_rt.ko

Application

3: VTSP_start

2: VTSP_init

1: OSAL_init

ve_gpl_osal_kernel.ko

ve_vtsp_rt.ko

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Launch vTSP

1 byte / 125 us

80 bytes per 10 ms

1: insmod ve_gpl_osal_kernel.ko

2: insmod ve_osal_kernel.ko

3: insmod ve_vtsp_hw.ko

4: insmod ve_vtsp_rt.ko

5: ./Application

ve_osal_kernel.ko ve_osal_kernel.ko

Page 79: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 79

(vTSP)

Voice

Telephony

Signal

Processing

ve_vtsp_rt.ko

ve_gpl_osal_kernel.ko

vApp

3: VTSP_start

2: VTSP_init

1: OSAL_init

ve_gpl_osal_kernel.ko

ve_vtsp_rt.ko

Launch vPort in Linux

0: rc.d2osal

1: insmod ve_gpl_osal_kernel.ko

2: insmod ve_osal_kernel.ko

3: insmod ve_vtsp_hw.ko

4: insmod ve_vtsp_rt.ko

5: ./vapp –i 172.16.60.9

ve_osal_kernel.ko

(vTSP)

Voice

Telephony

Signal

Processing

ve_osal_kernel.ko

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

/dev/d2/mq0

/dev/d2/mq1

/dev/d2/mq2

.

.

.

/dev/d2/mq63

Page 80: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 80

Agenda Overview

vPort architecture

Voice Sampling Technologies

Functional Blocks

Voice Path - from microphone to IP

Control Path- Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller IDs

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 81: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 81

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

1: OSAL_init

2: VTSP_init

3: VTSP_start

4: eventTask Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Read Status of vTSP: Hook Status

_VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY, &event, VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

Data Path

Event / Cmd Path

1: Pick up the phone

2: HW signal

3: SW Event

4: SW Event

5: VTSP_getEvent to receive that event

Page 82: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 82

void eventHdl(VTSP_EventMsg *event)

{

}

if ( == event.infc) {

/*

* Translate the event for the proper UA.

*/

if ( == event->code) {

switch (event->msg.hook.reason) {

case :

printf(“\n HOOK_SEIZE\n”);

break;

case :

printf(“\n HOOK_RELEASE\n”);

break;

case :

if (VTSP_EVENT_LEADING == event->msg.hook.edgeType) {

printf(“\n HOOK_FLASH\n”);

}

break;

}

}

Example of Event Parser:Hook

VTSP_EVENT_MSG_CODE_HOOK

VTSP_EVENT_HOOK_SEIZE

VTSP_EVENT_HOOK_RELEASE

VTSP_EVENT_HOOK_FLASH

VTSP_INFC_GLOBAL

Page 83: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 83

Events of vTSP

VTSP_EVENT_MSG_CODE_TRACE

VTSP_EVENT_MSG_CODE_RING_GENERATE

VTSP_EVENT_MSG_CODE_RING_DETECT

VTSP_EVENT_MSG_CODE_HOOK

VTSP_EVENT_MSG_CODE_TONE_GENERATE

VTSP_EVENT_MSG_CODE_TONE_DETECT

VTSP_EVENT_MSG_CODE_DIGIT_GENERATE

VTSP_EVENT_MSG_CODE_TIMER

VTSP_EVENT_MSG_CODE_CID_DETECT

VTSP_EVENT_MSG_CODE_CID_GENERATE

VTSP_EVENT_MSG_CODE_SHUTDOWN

VTSP_EVENT_MSG_CODE_ERROR

VTSP_EVENT_MSG_CODE_RTP

VTSP_EVENT_MSG_CODE_JB

VTSP_EVENT_MSG_CODE_STATISTIC

VTSP_EVENT_MSG_CODE_FLOW

VTSP_EVENT_MSG_CODE_RTCP

VTSP_EVENT_MSG_CODE_T38

void eventHdl(VTSP_EventMsg *event)

{

/*

* Translate the event for the proper UA.

*/

if (VTSP_EVENT_MSG_CODE_HOOK == event->code) {

….

}

}

Page 84: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 84

Notice

1: The Event of vTSP must be consumed in Application layer periodically

2: the structure of VTSP_EventMsg is defined in VTSP_struct.h

3: The full example code for VTSP_getEvent is in

UT_printEvent of …/vport/VTSP_ut/common/event.c

Page 85: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 85

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

1: OSAL_init

2: VTSP_init

3: VTSP_start

4: eventTask

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Read Status of vTSP: DTMF

_VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

VTSP_detect(0, VTSP_DETECT_DTMF |VTSP_DETECT_FMTD);

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY, &event, VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

Data Path

Event / Cmd Path

1: Pick up the phone

4: HW signal

5: SW Event

6: SW Event

7: VTSP_getEvent to receive that event 2: Press digit-1 on dial panel

3: Phone itself generate Tone

for digit-1

Page 86: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 86

void eventHdl(VTSP_EventMsg *event)

{

}

Example of Event Parser:DTMF

if ( == event.infc) {

if ( == event.code) {

if ( == event.msg.toneDetect.detect) {

switch (event.msg.toneDetect.edgeType) {

case :

printf(“\n User Press %d”, event.msg.toneDetect.tone);

break;

case :

printf(“\n User Press %d”, event.msg.toneDetect.tone);

break;

}

}

}

}

else if ( VTSP_DETECT_FMTD == event.msg.toneDetect.detect) {

printf(“\n FAX TONE detected”);

}

VTSP_EVENT_MSG_CODE_TONE_DETECT

VTSP_DETECT_DTMF

VTSP_EVENT_LEADING

VTSP_EVENT_TRAILING

/* Press Button of digit-1 */

/* Release Button of digit-1 */

VTSP_INFC_GLOBAL

Page 87: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 87

Notice

The status detection of following Item is enabled / disabled via VTSP_detect

VTSP_DETECT_DTMF: DTMF tone detection

VTSP_DETECT_VAD: Voice activity detection

VTSP_DETECT_FMTD: Fax/Modem tone detection

VTSP_DETECT_CALLERID_ONHOOK: Caller-ID detection on FXO

VTSP_DETECT_CALLERID_OFFHOOK: Caller-ID Call-Waiting detection on FXO

Page 88: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 88

How the application knows the right time to stop

“collecting dialing number”

Question:

Heartbeat of vTSP: Timer Event

Answer:

Page 89: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 89

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block

Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 90: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 90

Timer Event is usually used to know the

right time to do something

It is generated by vTSP periodically

Note:

Page 91: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 91

void eventHdl(VTSP_EventMsg *event)

{

}

Example of Event Parser:Timer

if (VTSP_INFC_GLOBAL == event.infc) {

if ((VTSP_EVENT_MSG_CODE_TIMER == event.code) &&

(1000 == event.msg.time.period)) {

printf(“\n 1 seocnd passed”);

}

}

Page 92: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 92

Timer Event and DTMF Detection:

Collect Digit

ControlDetectors(DTMF_ON)

ControlDetectors(DTMF_OFF)

Found DTMF Event in 4 Timer Events

CollectDigit(&Dialed_Digit)

No

Yes

Page 93: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 93

Split Task into

vTSP Event: To know what happened

and

vTSP Control: To instruct vTSP

Note:

Page 94: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 94

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

eventTask

_VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

Relationship of Task with vTSP

Page 95: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 95

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 96: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 96

Application vTSP

Idle

On hook VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_RELEASE

Off hook VTSP_EVENT_MSG_CODE_HOOK:VTSP_EVENT_HOOK_SEIZE

Enable Tone Detection VTSP_detect(obj_ptr->infc, VTSP_DETECT_DTMF | VTSP_DETECT_FMTD);

Procedure / Events of Dialing out

Disable Tone Detection VTSP_detect(obj_ptr->infc, 0);

Dial number VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

Accumlate Digit VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

.

.

.

.

Page 97: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 97

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 98: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 98

Something about Ring in vTSP

1: a pair of Ring_On and Ring_Off is called Cadence

2: There are at most 3 Cadence in a Ring Template

3: There are 10 Ring Templates in vTSP

time

Voltage

Page 99: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 99

Eaxmple and Explanation of Ring in vTSP

typedef struct {

uvint cadences;

uvint make1;

uvint break1;

uvint make2;

uvint break2;

uvint make3;

uvint break3;

uvint cidBreakNum;

} VTSP_RingTemplate;

VTSP_RingTemplate ringPattern1 = {

3, /* Number of cadences for this ring */

200, /* 200 ms ON for cadence 1*/

200, /* 200 ms OFF for cadence 1*/

800, /* 800 ms ON for cadence 2 */

800, /* 800 ms OFF for cadence 2 */

1000, /* 1000 ms ON for cadence 3 */

3000 /* 3000 ms OFF for cadence 3 */

3 /* CID transmit at cadence 3 break time */

};

time

Voltage

Page 100: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 100

Step to use Ring Explanation

VTSP_RingTemplate ringPattern1 = {

….

};

Application – owned Caller – ID message structure.

This structure is used for encapsulating the Caller-ID data string

and is initialized by the vTSP

Step 1:

VTSP_configRing(9, ringPattern1 );

Prototype: VTSP_Return VTSP_configRing(

uvint templateId,

VTSP_RingTemplate *templateData_ptr );

Program ring cadence into templateId

Detail explanation: chapter 2 of VTSP_Reference_Manual.pdf

Step 2:

VTSP_ring(

0,

9,

6,

VTSP_RING_TMAX, NULL);

Prototype: VTSP_ring(

uvint infc,

uvint templateId,

uvint numRings,

uvint maxTime,

VTSP_CIDData *cid_ptr);

This API is called by application to begin the ringing cadence on a

physical interface.

Detail explanation: chapter 3 of VTSP_Reference_Manual.pdf

Step 3:

VTSP_ringStop( 0);

Prototype: VTSP_ringStop( uvint infc);

This API is to stop the ring generation on the given FXS interface

Detail explanation: chapter 3 of VTSP_Reference_Manual.pdf

Step 4:

Step to use Ring

Page 101: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 101

Code Example of Ring

VTSP_RingTemplate ringPattern1 = {

3, /* Number of cadences for this ring */

200, /* 200 ms ON for cadence 1*/

200, /* 200 ms OFF for cadence 1*/

800, /* 800 ms ON for cadence 2 */

800, /* 800 ms OFF for cadence 2 */

1000, /* 1000 ms ON for cadence 3 */

3000 /* 3000 ms OFF for cadence 3 */

3 /* 3th cadence to insert FSKS */

};

VTSP_configRing(4, ringPattern1 )

/* Generate 6 rings to interface 0 with template 4

* maximum timeout, no Caller-ID

*/

VTSP_ring(0, 4, 6, VTSP_RING_TMAX, NULL);

OSAL_taskDelay(1000);

VTSP_ringStop(0);

Page 102: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 102

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

Relationship of Task with vTSP

ControlRing( );

Page 103: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 103

Something about Tone of vTSP

1: a pair of Tone_On and Tone_Off is called Cadence

2: There are at most 3 Cadence in a Tone Template

3: There are 30 Tone Templates in vTSP

4: Need to config frequency and power

5: allow user to set 2 pairs of frequency and power in order to generate Dual Tone (DTMF)

6: Each Cadence could repeat N times

time

Power

(0.5 dBmsteps)

Page 104: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 104

Example and Explanation of Tone in vTSP

time

Power

(0.5 dBm steps)

typedef struct {

vint freq1;

vint freq2;

vint power1;

vint power2;

vint cadences;

vint make1;

vint break1;

vint repeat1;

vint make2;

vint break2;

vint repeat2;

vint make3;

vint break3;

vint repeat3;

} VTSP_ToneTemplate;

VTSP_ToneTemplate ToneTemplate12 = {

200, /* frequency of the first tone */

600, /* frequency of the second tone */

-40, /* Power of the first tone in 0.5 dB steps */

-45, /* power of the second tone in 0.5 dB steps */

2, /* Number of makes / breaks, Must be equal to 1,2, or 3 */

1000, /* Time in milliseconds for generating tone on first cadence */

1000, /* Time in milliseconds to pause after tone generation on the first cadence */

1, /* Number of times to repeat the first cadence */

500, /* Time in milliseconds for generating tone on second cadence */

500, /* Time in milliseconds to pause after tone generation on the second cadence */

1, /* Number of times to repeat the second cadence */

0, /* Time in milliseconds for generating tone on third cadence */

0, /* Time in milliseconds to pause after tone generation on the third cadence */

0 /* Number of times to repeat the third cadence */

};

Page 105: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 105

Step to use Caller ID Explanation

VTSP_ToneTemplate ToneTemplate12 = {

….

};

Application – owned Caller – ID message structure.

This structure is used for encapsulating the Caller-ID data string

and is initialized by the vTSP

Step 1:

VTSP_configTone(9, &ToneTemplate12 );

Prototype: VTSP_Return VTSP_configTone(

uvint templateId,

VTSP_ToneTemplate *templateData_ptr );

Program tone cadence into templateId

Detail explanation: chapter 2 of VTSP_Reference_Manual.pdf

Step 2:

VTSP_toneLocal(

0,

9,

6

VTSP_TONE_TMAX);

Prototype: VTSP_toneLocal(

uvint infc,

uvint templateId,

uvint repeat,

uvint maxTime);

This API is called by application to begin the tone cadence on a

physical interface.

Detail explanation: chapter 5 of VTSP_Reference_Manual.pdf

Step 3:

VTSP_toneLocalStop( 0);

Prototype: VTSP_toneLocalStop( uvint infc);

This API is to stop the tone generation on the given FXS interface

Detail explanation: chapter 5 of VTSP_Reference_Manual.pdf

Step 4:

Step to use Tone

Page 106: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 106

Code Example of Tone in vTSP VTSP_ToneTemplate ToneTemplate12 = {

200, /* freq1 */

600, /* freq2 */

-40, /* power1 */

-45, /* power2 */

2, /* cadences */

1000, /* make1 */

1000, /* break1 */

1, /* repeat1 */

500, /* make2 */

500, /* break2 */

1, /* repeat2 */

0, /* make3 */

0, /* break3 */

0 /* repeat3 */

};

templateId = 4;

VTSP_configTone(templateId, &ToneTemplate12); /* Program template 4 */

interface = 0;

repeat = 6; /* Generate 6 tone cycles */

VTSP_toneLocal(interface, templateId, repeat, VTSP_TONE_TMAX);

OSAL_taskDelay(1000);

VTSP_toneLocalStop(interface);

Page 107: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 107

Special API: VTSP_toneLocalSequence MIX Voice with Break of Tone

Example:

uvint toneSeq[1];

toneSeq[0] = temp;

VTSP_toneLocalSequence(infc,

&toneSeq,

1,

VTSP_TONE_BREAK_MIX,

VTSP_TONE_NMAX);

SYNOPSIS:

VTSP_Return VTSP_toneLocalSequence(

uvint infc,

uvint *toneId_ptr,

uvint seqLength,

uint32 control,

uint32 repeat);

This function is used to generate a sequence of tones. Unlike VTSP_toneLocal(), this function

concatenates several tones sequences specified by its parameters.

If control is set to VTSP_TONE_BREAK_MIX, voice is not interrupted during the tone break times.

If control is set to 0, then voice is overwritten with silence during the tone break times.

Page 108: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 108

Notice

[0] = NULL; /*Silence Tone*/

[1] = &_vTSPR_toneVoipDialtone;

[2] = &_vTSPR_toneVoipBusy;

[3] = &_vTSPR_toneVoipReorder;

[4] = &_vTSPR_toneHowler;

[5] = &_vTSPR_toneVoipRingback;

[6] = &_vTSPR_toneVoipCWAlert;

[7] = &_vTSPR_toneTest0;

[8] = &_vTSPR_toneTest1;

[9] = &_vTSPR_toneTest2;

[10] = &_vTSPR_toneVoipReady;

[11] = &_vTSPR_toneVoipNotReady;

The first 12 of 30 toneTemplate has been used by vTSP, Their functionality is as below:

Could be overwrited

via VTSP_configTone

Page 109: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 109

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

ControlRing( );

Relationship of Task with vTSP

ControlTone( );

Page 110: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 110

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 111: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 111

Step to use Caller ID Step to use Caller ID Explanation

VTSP_CIDData cidObj;

Application – owned Caller – ID message structure.

This structure is used for encapsulating the Caller-ID data string

and is initialized by the vTSP

Step 1:

VTSP_cidDataPackInit(&cidObj);

Prototype: VTSP_Return VTSP_ciddataPackInit(VTSP_CIDData *cid_ptr)

Caller-ID Message Structure and Initialization

Step 2:

VTSP_cidDataPack(

VTSP_CIDDATA_FIELD_NAME,

“D2 tech",

&cidObj);

Prototype: VTSP_cidDataPack(

VTSP_CIDDatafields field,

char *string_ptr,

VTSP_CIDData *cid_ptr);

This API is called by application once or multiple times to append

Caller-ID fields to the Caller-ID message

Step 3:

VTSP_ring(

0,

ua_ptr->ringTemp,

VTSP_RING_NMAX,

VTSP_RING_TMAX,

&cidObj);

Prototype: please refer RING

This API is to generate a RING on FXS, so, phone machine

will get Type I Caller ID

Step 4.1:

VTSP_cidOffhook(

0,

&cidObj);

Prototype: VTSP_Return VTSP_cidOffhook(

uvint infc,

VTSP_CIDData *cid_ptr);

This API is called by application to generate Type II Caller ID

Step 4.2:

Page 112: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 112

Data Attribute of Caller ID

Page 113: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 113

Code Example of Caller ID in vTSP #define VTSP_RING_NMAX (uint16)(~0)

#define VTSP_RING_TMAX (uint32)(~0)

VTSP_CIDData cidObj;

VTSP_cidDataPackInit(&cidObj);

VTSP_cidDataPack(VTSP_CIDDATA_FIELD_NUMBER, "8052528260", &cidObj);

/*

* Type II Caller-ID

*/

VTSP_cidOffhook(obj_ptr->infc, &cidObj);

OSAL_taskDelay(1500);

VTSP_cidDataPack(VTSP_CIDDATA_FIELD_NAME, "Zubair Khan", &cidObj);

/*

* Type I Caller-ID

*/

VTSP_ring(obj_ptr->infc, ua_ptr->ringTemp, VTSP_RING_NMAX, VTSP_RING_TMAX, &cidObj);

OSAL_taskDelay(1500);

Page 114: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 114

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

ControlTone( );

ControlRing( );

Relationship of Task with vTSP

ControlCallerId( );

Page 115: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 115

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 116: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 116

Procedure / Events of picking up a call

Application vTSP

Idle

Disable Ring VTSP_ringStop(obj_ptr->infc);

Off hook VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_SEIZE Send SIP-OK

On hook Send SIP-BYE

VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_RELEASE

Receive SIP-Invite

Send SIP-Trying

Enable Ring VTSP_ring(obj_ptr->infc, ua_ptr->ringTemp, VTSP_RING_NMAX, VTSP_RING_TMAX, CALLER); CALLER-ID SHOW

Page 117: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 117

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 118: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 118

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

FIFO Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Estimator Silence Compressor

Echo

Estimator G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

DTMF

Detector DTMF Relay Encode

(RFC 2833)

Control

status

voice

C

O

D

E

C

/

S

L

I

C

The Configurable Component

for Voice Stream Control

Sendto

recvfrom

Jitter

Buffer

Extract

Payload

And

Type of Encoder

From RTP Caller-ID

Generator

Encoder

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end

Page 119: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 119

socket

typedef struct {

vint streamId; /*Number of stream on the interface*/

VTSP_StreamDir dir; /*Direction of the stream*/

uint16 peer; /*Indicate the type of stream, network or local*/

vint encoder; /* Voice Coding Algorithm to use for encoding*/

vint encodeTime[VTSP_ENCODER_NUM];

vint encodeType[VTSP_ENCODER_NUM];

vint decodeType[VTSP_DECODER_NUM];

uint16 extension; /*A bit field for coder extensions, for future use*/

uint16 dtmfRelay;

uint16 silenceComp;

uint32 confMask;

uint32 remoteIpAddr; /* must be network byte order */

uint16 remoteDataPort; /* must be network byte order */

uint16 remoteControlPort; /* must be network byte order */

uint32 localIpAddr; /* must be network byte order */

uint16 localDataPort; /* must be network byte order */

uint16 localControlPort; /* must be network byte order */

} VTSP_Stream;

The Variable for Configurable Component

on Voice Stream Path

recvfrom Sendto

G.711 A-law

G.711 μ -law

G.726_32

G.729_AB

Encoder

Peer

/

Local

Mixer

Decoder

Tone Generator

Comfortable Noise

Generator

G711 A-law

G711 μ -law

G726_32

G729_AB

P

L

C

Noise Floor Estimator

Far end

DTMF Relay Encode

(RFC 2833)

Silence Compressor

Page 120: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 120

Step to use Stream in vTSP I Step to use Stream Explanation

VTSP_Stream stream0;

Application – Stream configuration structure.

This structure is used as configuration data in conjunction

with a Stream function call

Step 1:

VTSP_streamStart(

0,

&stream0);

Prototype: VTSP_Return VTSP_streamStart(

uvint infc,

VTSP_Stream *stream_ptr);

Voice Stream Initialization and start

Step 2:

VTSP_streamModify(

0,

&stream0);

Prototype: VTSP_Return VTSP_streamModify(

uvint infc,

VTSP_Stream *stream_ptr);

The application modifies a stream after It has started by

assigning new values to the stream structure and calling

this function.

The application may modify multiple elements of the stream

data structure at one time.

Step 3:

VTSP_streamEnd(0,&stream0);

Prototype: VTSP_Return VTSP_streamEnd(

uvint infc,

uvint streamId);

The application ends a stream by calling this function

Step 4:

Page 121: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 121

Step to use Stream in vTSP II Step to use Stream Explanation

VTSP_streamModify(

0,

&stream0);

Prototype: VTSP_Return VTSP_streamModify(

uvint infc,

VTSP_Stream *stream_ptr);

The application modifies a stream after It has started by assigning new values to the

stream structure and calling this function.

The application may modify multiple elements of the stream data structure at one time.

Step 3:

VTSP_streamModifyDir(

0,

0,

VTSP_STREAM_DIR_SENDRECV);

Prototype: VTSP_Return VTSP_streamModifyDir(

uvint infc,

uvint streamId,

VTSP_StreamDir dir);

The application modifies a stream’s direction with this function, Other aspects of

the stream remain unchanged.

Calling this function is identical to modifying the stream data structure and calling the

VTSP_streamModify( ) function.

Step 3.1:

VTSP_streamModifyConf(

0,

0

1);

Prototype: VTSP_Return VTSP_streamModifyConf(

uvint infc,

uvint streamId,

uvint confMask);

The application modifies a stream conf and confStream with this function, Other aspects of

the stream remain unchanged.

Calling this function is identical to modifying the stream data structure and calling the

VTSP_streamModify( ) function.

Step 3.3:

VTSP_streamModifyEncoder(

0,

0,

0);

Prototype: VTSP_Return VTSP_streamModifyDir(

uvint infc,

uvint streamId,

uvint coder);

The application modifies a stream type with the given stream’s encoder with this function. Other aspects

of the stream remain unchanged.

Calling this function is identical to modifying the stream data structure and calling the

VTSP_streamModify( ) function.

Step 3.2:

Page 122: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 122

S

O

C

K

E

T

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Peer

/

Local

Mixer

Control

status

voice

C

O

D

E

C

/

S

L

I

C

VTSP_Stream Structure and vTSP’ component I

Sendto

recvfrom

Jitter

Buffer

IP addr

Comparsion

Decoder

Encoder

typedef struct {

vint streamId;

VTSP_StreamDir dir;

uint16 peer;

vint encoder;

vint encodeTime[VTSP_ENCODER_NUM];

vint encodeType[VTSP_ENCODER_NUM];

vint decodeType[VTSP_DECODER_NUM];

uint16 extension;

uint16 dtmfRelay;

uint16 silenceComp;

uint32 confMask;

uint32 remoteIpAddr;

uint16 remoteDataPort;

uint16 remoteControlPort;

uint32 localIpAddr;

uint16 localDataPort;

uint16 localControlPort;

} VTSP_Stream;

VTSP_streamStart(0,&stream0);

socketFd = socket(AF_INET, SOCK_DGRAM,

IPPROTO_UDP);

retVal = bind(socketFd, (struct sockaddr *)&(bindAddr),

sizeof(struct sockaddr));

typedef enum {

_VTSP_STREAM_DIR_ENDED = 0,

VTSP_STREAM_DIR_INACTIVE = 1,

VTSP_STREAM_DIR_SENDONLY = 2,

VTSP_STREAM_DIR_RECVONLY = 3,

VTSP_STREAM_DIR_SENDRECV = 4

} VTSP_StreamDir;

Page 123: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 123

S

O

C

K

E

T

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Peer

/

Local

Mixer

Control

status

voice

C

O

D

E

C

/

S

L

I

C

VTSP_Stream Structure and vTSP’s component II

Sendto

recvfrom

Jitter

Buffer

IP addr

Comparsion

Decoder

Encoder

typedef struct {

vint streamId;

VTSP_StreamDir dir;

uint16 peer;

vint encoder;

vint encodeTime[VTSP_ENCODER_NUM];

vint encodeType[VTSP_ENCODER_NUM];

vint decodeType[VTSP_DECODER_NUM];

uint16 extension;

uint16 dtmfRelay;

uint16 silenceComp;

uint32 confMask;

uint32 remoteIpAddr;

uint16 remoteDataPort;

uint16 remoteControlPort;

uint32 localIpAddr;

uint16 localDataPort;

uint16 localControlPort;

} VTSP_Stream; Infc 0

Infc 1

Stream0.peer is VTSP_STREAM_PEER_NETWORK Stream1.peer is 1

Indicates the type of stream, Network or Local

For network streams, peer is set to VTSP_STREAM_PEER_NETWORK

For local streams, peer is set to the physical interface number of the peer

interface

A bitmask of contributing streams for conferencing.

Setting bit N in this number to 1 will conference streamId #N into this stream

Rate: 10ms, 20ms, 30ms, 40ms

G.711U is 0, G.711A is 8, G.726 is 2, G.729AB is 18

G.711U is 0, G.711A is 8, G.726 is 2, G.729AB is 18

Page 124: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 124

Code Example for Stream in vTSP /*

Create a two party VoIP call with a remote endpoint.

In this example, interface = 0

In this example, all members of the stream structure are specifically

initialized.

*/

VTSP_Stream stream0;

stream0.streamId = 0; /* Stream 0 streamId */

VTSP_streamStart(interface, &stream0);

stream0.peer = VTSP_STREAM_PEER_NETWORK;

stream0.dir = VTSP_STREAM_DIR_SENDRECV;

stream0.encoder = VTSP_CODER_G729; /* payload type to network */

stream0. remoteIpAddr = ntohl(remoteIpAddr ); /* network byte order */

stream0. remoteDataPort = ntohs(remoteDataPort ); /* network byte order */

stream0. localIpAddr = ntohl(localIpAddr); /* network byte order */

stream0. localDataPort= ntohs(localDataPort); /* network byte order */

….

….

Page 125: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 125

Stream Direction in Call making

Stream 0:

VTSP_STREAM_DIR_INACTIVE

Stream 0:

VTSP_STREAM_DIR_RECVONLY

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Page 126: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 126

Code Example for Step 1

Adding a third party to a VoIP Conference Call /*

Create a two party VoIP call with a remote endpoint.

In this example, interface = 0

In this example, all members of the stream structure are specifically

initialized.

*/

VTSP_Stream stream1;

stream1.streamId = 1; /* Stream 1 streamId */

VTSP_streamStart(interface, &stream1);

stream1.peer = VTSP_STREAM_PEER_NETWORK;

stream1.dir = VTSP_STREAM_DIR_SENDRECV;

stream1.encoder = VTSP_CODER_G729; /* payload type to network */

stream1.sendIpAddr = ntohl(peerAddr); /* network byte order */

stream1.sendIpPort = ntohs(peerRtpPort); /* network byte order */

stream1.recvIpAddr = ntohl(peerAddr); /* network byte order */

stream1.recvIpPort = ntohs(myRtpPort); /* network byte order */

….

….

Page 127: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 127

The Conference style: Symmetric Stream Model

Stream 0:

VTSP_STREAM_DIR_INACTIVE

Stream 0:

VTSP_STREAM_DIR_RECVONLY

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Stream 1:

VTSP_STREAM_DIR_INACTIVE

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Stream 1:

VTSP_STREAM_DIR_RECVONLY

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Stream 1:

VTSP_STREAM_DIR_SENDRECV

Page 128: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 128

The vTSP conferences audio to the physical

interface from multiple parties

The vTSP send to individual endpoints are non-

conferenced payloads. Each endpoint is

responsible for conferencing voice payloads

received from the other points

Note:

Page 129: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 130

Code example for step 2

Mixing another Voice Stream to a VoIP

Conference Call /*

In this example, interface = 0

In this example, all members of the stream structure are specifically initialized.

*/

VTSP_Stream stream1;

stream1.streamId = 1; /* Stream 1 streamId */

VTSP_streamStart(interface, &stream1);

stream1.peer = VTSP_STREAM_PEER_NETWORK;

stream1.dir = VTSP_STREAM_DIR_SENDRECV;

stream1.encoder = VTSP_CODER_G729; /* payload type to network */

stream1.sendIpAddr = ntohl(peerAddr); /* network byte order */

stream1.sendIpPort = ntohs(peerRtpPort); /* network byte order */

stream1.recvIpAddr = ntohl(peerAddr); /* network byte order */

stream1.recvIpPort = ntohs(myRtpPort); /* network byte order */ ….

….

stream1.confMask = (1 << stream0.streamId);

VTSP_streamModifyConf(interface, stream0.streamId, (1 << stream1.streamId));

Page 130: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 131

The Conference style:

Minimum Bandwidth Stream Model

Stream 0:

VTSP_STREAM_DIR_INACTIVE

Stream 0:

VTSP_STREAM_DIR_RECVONLY

Stream 0:

VTSP_STREAM_DIR_SENDRECV

Stream 1:

VTSP_Stream stream1;

stream1.streamId = 1;

stream1.dir =

VTSP_STREAM_DIR_SENDRECV;

...

stream1.confMask =

(1 << stream0.streamId);

...

VTSP_streamStart(infc_0, &stream1);

Stream 0:

VTSP_streamModifyConf(

infc_0,

stream0.streamId,

(1 << stream1.streamId));

Page 131: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 132

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

ControlTone( );

ControlRing( );

ControlCallerId( );

Relationship of Task with vTSP

ControlStream( );

Page 132: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 133

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 133: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 134

Procedure / Events of picking up a call and talking from network

Application vTSP

Idle

Off hook

Disable Ring VTSP_ringStop(obj_ptr->infc);

VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_SEIZE Send SIP-OK

On hook Send SIP-BYE

Stop Voice Stream VTSP_streamEnd(0,&stream0);

VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_RELEASE

Enable Ring

Receive SIP-Invite

Send SIP-Trying

VTSP_ring(obj_ptr->infc, ua_ptr->ringTemp, VTSP_RING_NMAX, VTSP_RING_TMAX, CALLER); CALLER-ID SHOW

Start Voice Stream VTSP_streamStart(0,&stream0);

Conversation

Page 134: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 135

Vocie Path of picking up a call and talking from network

S

O

C

K

E

T

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Peer

/

Local

Mixer

Control

status

voice

C

O

D

E

C

/

S

L

I

C

Sendto

recvfrom

Jitter

Buffer

IP addr

Comparsion

Decoder

Encoder

Infc 0

Page 135: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 136

Vocie Path of picking up a call and talking from Interface

Event / CMD Queue

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

μ-Law 2

Linear

Converter

(vTSP)

Voice Telephony Signal Processing

Echo

Canceller

linear 2

μ-Law

Converter

SW Gain

Controller

Peer

/

Local

Mixer

Echo

Estimator

Control

status

voice

C

O

D

E

C

/

S

L

I

C

Infc 1

Infc 0

Page 136: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 137

Agenda

Overview vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 137: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 138

Procedure / Events of 3 way conf. call – Adding a third party

Application vTSP

Idle

Off hook VTSP_EVENT_MSG_CODE_HOOK:VTSP_EVENT_HOOK_SEIZE

Start Dial Tone Play VTSP_toneLocal(obj_ptr->infc, dialTone, VTSP_TONE_NMAX, VTSP_TONE_TMAX)

Enable Tone Detection VTSP_detect(obj_ptr->infc, VTSP_DETECT_DTMF | VTSP_DETECT_FMTD);

Dial number VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

Accumlate Digit

Stop Dial Tone Play

VTSP_toneLocalStop(obj_ptr->infc)

VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

Disable Tone Detection VTSP_detect(obj_ptr->infc, 0);

Send SIP-Invite A

Start Ring Back Tone Play VTSP_toneLocal(obj_ptr->infc, ringbackTone, VTSP_TONE_NMAX, VTSP_TONE_TMAX)

Receive SIP-Trying A

Receive SIP-Ringing A

Receive SIP-OK A

Stop Ring Back Tone Play VTSP_toneLocalStop(obj_ptr->infc)

Start Voice Stream VTSP_streamStart(0,&stream0); VAPP_STREAM_DIR_SENDRECV

Send SIP-ACK A

Hook_Flash VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_FLASH Send SIP-Invite A

Send SIP_OK A

Send SIP_ACK A VTSP_streamModifyDir(0,&stream0, VTSP_STREAM_DIR_INACTIVE);

Start Talking with A

Stop Talking with A

Page 138: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 139

Application vTSP

Start Dial Tone Play VTSP_toneLocal(obj_ptr->infc, dialTone, VTSP_TONE_NMAX, VTSP_TONE_TMAX)

Enable Tone Detection VTSP_detect(obj_ptr->infc, VTSP_DETECT_DTMF | VTSP_DETECT_FMTD);

Dial number VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

Accumlate Digit

Stop Dial Tone Play

VTSP_toneLocalStop(obj_ptr->infc)

VTSP_EVENT_MSG_CODE_TONE_DETECT: VTSP_DETECT_DTMF

Disable Tone Detection VTSP_detect(obj_ptr->infc, 0);

Send SIP-Invite B

Start Ring Back Tone Play VTSP_toneLocal(obj_ptr->infc, ringbackTone, VTSP_TONE_NMAX, VTSP_TONE_TMAX)

Receive SIP-Trying B

Receive SIP-Ringing B

Receive SIP-OK B

Stop Ring Back Tone Play VTSP_toneLocalStop(obj_ptr->infc)

Start Voice Stream VTSP_streamStart(0,&stream1); VAPP_STREAM_DIR_SENDRECV

Send SIP-ACK B

Hook_Flash VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_FLASH Send SIP-Invite A

Send SIP_OK A

Send SIP_ACK A

Procedure / Events of 3 way conf. call – Adding a third party

Start Talking with B

Page 139: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 140

Application vTSP

VTSP_streamModifyDir(0,&stream0, VTSP_STREAM_DIR_SENDRECV);

VTSP_streamModifyConf(0,&stream0, 2);

VTSP_streamModifyConf(0,&stream1, 1);

Hook_Flash VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_FLASH Send SIP-Invite B

Send SIP_OK B

Send SIP_ACK B

VTSP_streamModifyConf(0,&stream0, 0);

VTSP_streamModifyConf(0,&stream1, 0);

VTSP_streamModifyDir(0,&stream0, VTSP_STREAM_DIR_INACTIVE);

Hook_Flash VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_FLASH Send SIP-Invite A

Send SIP_OK A

Send SIP_ACK A

VTSP_streamModifyConf(0,&stream0, 0);

VTSP_streamModifyConf(0,&stream1, 0);

VTSP_streamModifyDir(0,&stream1, VTSP_STREAM_DIR_INACTIVE);

VTSP_streamModifyDir(0,&stream0, VTSP_STREAM_DIR_SENDRECV);

Hook_Flash VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_FLASH Send SIP-Invite B

Send SIP_OK B

Send SIP_ACK B

VTSP_streamModifyConf(0,&stream0, 2);

VTSP_streamModifyConf(0,&stream1, 1);

VTSP_streamModifyDir(0,&stream1, VTSP_STREAM_DIR_SENDRECV);

ON Hook Send SIP-BYE_A

Send SIP-BYE_B Stop Voice Stream_A

Stop Voice Stream_B

VTSP_streamEnd(0,&stream0);

VTSP_EVENT_MSG_CODE_HOOK: VTSP_EVENT_HOOK_RELEASE

VTSP_streamEnd(0,&stream1);

Procedure / Events of 3 way conf. call – Adding a third party

Start Talking with A and B

Stop Talking with A

Start Talking with B

Start Talking with A

Stop Talking with B

Start Talking with A and B

Page 140: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 141

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 141: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 142

Step to use flow in vTSP I Step to use Stream Explanation

VTSP_flowOpen(…);

Prototype: vint VTSP_flowOpen(

uvint infc,

uvint streamId,

uvint flowDir,

uvint key,

uvint recordCoder );

Return value: flowId

Purpose: Flow Initialization

Step 1:

Argument Name Argument Description

infc The number of the physical interface.

streamId

flowDir

key

recordCoder

Number of the stream on the interface..

Direction of the flow for play or record.

The number of the physical interface.

Voice coding algorithm to use for recording or playing

Argument Name Argument Description

flowId The number of the flow interface. This is the return value of VTSP_flowOpen

blockSize

*data_ptr

control

timeout

The size of one unit of data_ptr for play.suggested blockSize is 400 bytes

The pointer of data block to play

To set which DTMF digits is allowed to terminate flows..

Specifying a timeout (milliseconds) uses operating system specific calls for blocking

VTSP_flowPlay(

flowId,

VTSP_CODER_G711U,

blockSize,

data_ptr,

control,

VTSP_TIMEOUT_FOREVER);

Prototype: vint VTSP_flowPlay (

vint flowId,

uvint coder,

uvint blockSize,

void *data_ptr,

uint32 control,

uint32 timeout);

Return value: VTSP_OK or others for failure

Purpose: To play a data block with specified coder on flowId

coder Voice coding algorithm to use for playing

Step 2.1:

Page 142: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 143

Step to use flow in vTSP II Step to use Stream Explanation

Argument Name Argument Description

flowId The number of the flow interface. This is the return value of VTSP_flowOpen

blockSize

*data_ptr

control

timeout

The size of one unit of data_ptr for play..

The pointer of data block to play

To set which DTMF digits is allowed to terminate flows..

Specifying a timeout (milliseconds) uses operating system specific calls for blocking

VTSP_flowPlaySil(

flowId,

VTSP_CODER_CN,

1,

data_ptr,

15,

control,

2050);

Prototype: vint VTSP_flowPlaySil (

vint flowId,

uvint coder,

uvint blockSize,

void *data_ptr,

uint32 duration,

uint32 control,

uint32 timeout);

Return value: VTSP_OK or others for failure

Purpose: To play a data block with specified coder on flowId

coder Voice coding algorithm to use for playing

duration The duration of silence frame in 10 ms units.

Step 2.2:

Page 143: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 144

Step to use flow in vTSP III Step to use Stream Explanation

Argument Name Argument Description

flowId The number of the flow interface. This is the return value of VTSP_flowOpen

VTSP_flowClose(

flowId);

Prototype: vint VTSP_flowClose(

vint flowId);

Return value: VTSP_OK or negative number for failure

Purpose: To close a flow

Argument Name Argument Description

flowId The number of the flow interface. This is the return value of VTSP_flowOpen

blockSize

*data_ptr

timeout

The max size of payload. It is VTSP_QueryData->flow.payloadMaxSz by VTSP_query()

The pointer of data block for recording

Specifying a timeout (milliseconds) uses operating system specific calls for blocking

VTSP_flowRecord(

flowId,

maxSz,

&coder

data_ptr,

&duration,

timeout);

Prototype: vint VTSP_flowRecord (

vint flowId,

uvint blockSize,

uvint *coder,

void *data_ptr,

uint32 *duration,

uint32 timeout);

Return value: VTSP_OK or negative number for failure

Purpose: To record the duration of voice into *data_ptrt with specified coder on flowId

coder Voice coding algorithm to use in recorded data

duration For future use

Step 2.3:

Argument Name Argument Description

flowId The number of the flow interface. This is the return value of VTSP_flowOpen

timeout Specifying a timeout (milliseconds) uses operating system specific calls for blocking

VTSP_flowAbort(

flowId,

timeout);

Prototype: vint VTSP_flowAbort(

vint flowId,

uint32 timeout);

Return value: VTSP_OK or negative number for failure

Purpose: To record the duration of voice into *data_ptrt with specified coder on flowId

Step 2.4:

Step 3:

Page 144: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 145

Code Example for Flow Recoding and Playing uint8 data_ptr[40000];

flowCleanup:

VTSP_flowClose(flowId);

vTSPQueryData_ptr = VTSP_query();

maxSz = vTSPQueryData_ptr->flow.payloadMaxSz;

keyMask = vTSPQueryData_ptr->flow.keyMask;

timeout = VTSP_TIMEOUT_FOREVER;

if((flowId = VTSP_flowOpen(infc, streamId,

(VTSP_FLOW_DIR_LOCAL_PLAY | VTSP_FLOW_DIR_LOCAL_RECORD),

key, VTSP_CODER_G711U)) < 0) {

goto flowCleanup;

}

Record_SZ = 0;

for (iloop = 0; iloop < 100; iloop++) {

if ((blockSize = VTSP_flowRecord(flowId, maxSz, &coder, data_ptr+(Record_SZ),

&duration, timeout)) > 0) {

Record_SZ = Record_SZ + blockSize;

if (coder != lastCoder) {

OSAL_logMsg("%s:%d Coder Changed\n",(int)__FILE__, __LINE__, 0,0);

lastCoder = coder;

}

}

}

Play_SZ = 400;

for (iloop = 0; iloop < 100; iloop++) {

retVal = VTSP_flowPlay(flowId, coder, blockSize, data_ptr + (iloop * Play_SZ), control, timeout);

if (retVal != VTSP_OK) {

goto flowCleanup;

}

}

Page 145: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 146

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

ControlTone( );

ControlRing( );

ControlCallerId( );

ControlStream( );

Relationship of Task with vTSP

ControlFlowPlay( );

Page 146: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 147

Agenda Overview

vPort architecture

Voice Sampling Technologies

vTspFunctional Block

Voice path - from microphone to IP

Voice Signal Processing

Voice path - from IP to speaker

Jitter Buffer and PLC

Type I and II Caller ID

Programming Guide

ve_osal_kernel

Launch vTSP

Example with vTSP: Read Status (Hook, DTMF)

Example with vTSP: Collect Digits (Timer)

Procedure / Events of Dialing out

Example with vTSP: Ring, Tone

Example with vTSP: Caller ID

Procedure / Events of picking up a call

Example with vTSP: Stream mixed for Conference

Procedure / Events of picking up a call and Talking

Procedure / Events of 3 way conf. call – Adding a third party

Example with vTSP: Flow Play

Telephony Interface Control

Q&A

Page 147: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 148

Telephony Interface Control

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Function name Purpose

Control the telephony hardware state for an interface (FXS or FXO) VTSP_Return VTSP_infcControlHook(

uvint infc,

VTSP_InfcHook control);

Control the telephony hardware for an interface,such as

PSTN (FXO) relay control,

General purpose IO control.

VTSP_Return VTSP_infcControlIO(

uvint infc,

uvint control,

uint16 value);

Request a line status event VTSP_Return VTSP_infcLineStatus(

uvint infc);

Control the analog gain of an interface

VTSP_Return VTSP_infcControlGain(

uvint infc,

vint gainTx,

vint gainRx);

Extra Telephony Control function

will be implemented here

Page 148: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 149

eventTask

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control _VAPP_VTSP_EVENT_TASK_LOOP:

send = 0;

memset(&msg, 0, sizeof(VAPP_Msg));

goto _VAPP_VTSP_EVENT_TASK_LOOP;

if (VTSP_OK == VTSP_getEvent(VTSP_INFC_ANY,

&event,

VTSP_TIMEOUT_FOREVER)) {

}

eventHdl(&event);

Get

another

One event

controlTask

ControlDetectors( )

CollectDigits( );

ControlTone( );

ControlRing( );

ControlCallerId( );

ControlStream( );

ControlFlowPlay( );

Relationship of Task with vTSP

ControlHook( );

ControlGain( );

ControlRelay( );

Page 149: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 150

Unit Test for vTSP /mnt/modules # insmod ve_gpl_osal_kernel.ko

/mnt/modules # insmod ve_osal_kernel.ko

/mnt/modules # insmod ve_vtsp_hw.ko

/mnt/modules # insmod ve_vtsp_rt.ko

/mnt/modules # ./ve_vtsp_ut -i

== VTSP_UT == Cmd:

=====================

D2 Tech VTSP Sys Test +D2Tech+ VPORT VPORT_R_1_3_120

=====================

Command Description

------- -----------

! Escape to Shell

preinit VTSP pre-init API test

i Perform regular init

shutdown VTSP shutdown API test

initcheckVTSP check for 2nd init API test

r FXS Ring and CID Onhook test

tg Tone generation infc gain test

s2 Stream test, 2 boards

s1 Stream test, 1 board, network loopback

v1i2 VQT Stream, 1 board/2 infcs, events=off

v2 VQT Stream test, 2 boards, events=off

v3 VQT Conf Stream, 3 boards, events=off

v4 VQT Stream test, 2 boards, Multiple Coder

vce-i0 Voice Conference Endpoint, infc0

vce-i1 Voice Conference Endpoint, infc1

vcb-i0 Voice Conference Bridge, infc0

t1 Tone local sequence test

t2 Tone local sequence with mixing

p1 Local Flow Play with Inactive Streams

p2 Local Flow Play Test, network loopback

p3 Peer Flow Play Test, network loopback

rp1 Local Flow Play/Record Test

c Caller-ID General Test

cidseq Caller-ID Sequence Test

ciddtmf Caller-ID DTMF FXS Send, FXO Receive Test

vmwi FXS CID Visual Message Waiting Indicator

relay FXS/PSTN Relay Test

netbind Network Bind Test

nettx Network TX Test

level Audio Level Test

hook FXS/FXO Hook Control

dial FXO Dialing string

quad Tone Quad generation

ticflash Configure the tic min./max. flash time

osaltask Test OSAL taskCreate()

setevent Set Events for Printing

q Quit (exit vtsp_ut)

== VTSP_UT == Cmd:

Page 150: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 151

The further explanation is in

vTSP_Reference_Manual.pdf

Page 151: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 152

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

Q&A

Page 152: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 153

Driver and Hardware

vTSP

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

vTSP

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

OSAL

SPI Unit

TDM

DMAs

Clock

Generator

Cavium EVB

Codec/SLIC

Codec/SLIC Voice

Commands

Status

SPI

PCM

Interrupt

Page 153: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 154

vTSP VHW

TIC

OSAL

SPI Unit

TDM

DMAs

Clock

Generator

Cavium EVB

Codec/SLIC

Codec/SLIC

Voice

Commands

Status

SPI

PCM

Interrupt

vTSP VHW

TIC

OSAL

Cavium EVB

Codec/SLIC

Si3210

Codec/SLIC

Si3210

Voice

Commands

Status

SPI

SPI Unit

Clock

Generator 0

TDM

DMA 0

TDM

DMA 1

Clock

Generator 1

TDM

DMA 2

TDM

DMA 3

Interrupt

Clock

FSYNC

SCLK

SDI

SDO

CS

CS

SC

LK

SD

I / SD

O

SD

O / S

DI

Clock

FSYNC

By connecting the devices this way,

the 10 ms blocks may not start and

stop in the proper synchronization

By connecting the devices this way,

the 10 ms blocks could start and

stop in the proper synchronization

Page 154: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 155

0 1 2 ,,,, 31 0 1 2 ,,,, 31 ,,,, 0 1 2 ,,,, 31

time

TDM Serial Data Stream

TDM Frame Sync

Data ready for buffer

exchange

B0 - 00

B0 - 01

B0 - 79

B1 - 00

B1 - 01

B1 - 79

VTSP

Operation of getting Data from PCM

A0 - 00

A0 - 01

A0 - 79

A1 - 00

A1 - 01

A1 - 79

Page 155: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 156

0 1 2 ,,,, 31 0 1 2 ,,,, 31 ,,,, 0 1 2 ,,,, 31

time

TDM Serial Data Stream

B0 - 00

B0 - 01

B0 - 79

B1 - 00

B1 - 01

B1 - 79

VTSP

Operation of putting Data into PCM

A0 - 00

A0 - 01

A0 - 79

A1 - 00

A1 - 01

A1 - 79

Page 156: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 157

Read / Write PCM at same time

static irqreturn_t _VHW_pcmISR(

int irq,

void *vhw_ptr,

struct pt_regs *regs)

{ ….

if (wrapFlags == 0xf) {

vint_ptr = _VHW_ptr->tx_ptr;

octet_ptr = _VHW_ptr->pcmXmitArray0_ptr + VHW_PCM_BUF_SZ;

for (count = 0; count < VHW_PCM_BUF_SZ; count++) {

*(octet_ptr++) = (uint8)(*(vint_ptr++));

}

vint_ptr = _VHW_ptr->tx_ptr + VHW_PCM_BUF_SZ;

octet_ptr = _VHW_ptr->pcmXmitArray1_ptr + VHW_PCM_BUF_SZ;

for (count = 0; count < VHW_PCM_BUF_SZ; count++) {

*(octet_ptr++) = (uint8)(*(vint_ptr++));

}

octet_ptr = _VHW_ptr->pcmRecvArray0_ptr + VHW_PCM_BUF_SZ;

vint_ptr = _VHW_ptr->rx_ptr;

for (count = 0; count < VHW_PCM_BUF_SZ; count++) {

*(vint_ptr++) = (vint)(*(octet_ptr++));

}

octet_ptr = _VHW_ptr->pcmRecvArray1_ptr + VHW_PCM_BUF_SZ;

vint_ptr = _VHW_ptr->rx_ptr + VHW_PCM_BUF_SZ;

for (count = 0; count < VHW_PCM_BUF_SZ; count++) {

*(vint_ptr++) = (vint)(*(octet_ptr++));

}

}

….

} Operation of getting Data from PCM

Operation of putting Data into PCM

Page 157: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 158

SW Architecture of Driver

vTSP Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

tic.c

int TIC_init(…)

int TIC_initInfc(…)

int TIC_run(…)

int TIC_shutdown(…)

int TIC_getBatteryPol(…)

int TIC_setHookFlash(…)

_tic.c

int32 _TIC_initHw(…)

uint8 _TIC_readSi3210DirectSpi(…)

uint16 _TIC_readSi3210IndirectSpi(…)

void _TIC_writeSi3210DirectSpi(…)

void _TIC_writeSi3210IndirectSpi(…)

int _TIC_fxsGetHookStatus(…)

void _TIC_shutdownHw(…)

API used by vhw for

1: initialize the processor HW

voice communication

2: ISR to collect PCM data

API used by TIC for

1: SPI communication

2: Codec initializaion

3: Codec control

_ vhw.c

int _VHW_allocHw(…)

void _VHW_dmaInit(void)

void _VHW_start(…) static irqreturn_t _VHW_pcmISR(…)

void _VHW_freeHw(…)

vhw.c

int VHW_init(..)

void VHW_start(…)

void VHW_exchange(…)

uint32 VHW_getTime(…)

void VHW_delay(…)

void VHW_shutdown(…)

API used by the vTSP for

1: PCM data exchange and

2: to get system time

API used by the vTSP for

1: TIC initialization,

2: shutdown,

3: operation and

4: telephony control

Page 158: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 159

Driver in vTSP

Timing Function

VHW_exchange

(Voice Exchange)

TIC_run

(Read Register on Codec/Slic)

Recv All Cmd

Gen All Event

Process audio received

from the hardware driver

CallerId Send

Process audio for transmission

to the hardware driver

void VHW_exchange(

vint **tx_ptr,

vint **rx_ptr)

{

/*

* Blocking request for data

*/

_VHW_sleepForPcmData(tx_ptr, rx_ptr);

}

void _VHW_sleepForPcmData(…)

{

….

/* The following function blocks */

OSAL_semAcquire(_VHW_ptr->sem, OSAL_WAIT_FOREVER);

….

}

static irqreturn_t _VHW_pcmISR(…)

{

….

/* Operation of putting Data into PCM */

/* Operation of getting Data from PCM */

….

OSAL_semGive(_VHW_ptr->sem);

….

}

Page 159: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 160

Unit Test for driver

/mnt/modules # insmod ve_gpl_osal_kernel.ko

/mnt/modules # insmod ve_osal_kernel.ko

/mnt/modules # insmod ve_vtsp_hw.ko

/mnt/modules # insmod ve_vtsp_hw_ut.ko

vtsp_hw_ut.c:587 Device is registered successfuly.

VHW initialized

TIC initialized

Usage echo X > /dev/tictest

Where X:

0 - Sieze/Release Test

1 - Ring Test

2 - Not Used

3 - Seize/Release/Hookflash Test

4 - Not Used

5 - Not Used

6 - Play Silence

7 - Set Battery Polarity - Normal

8 - Set Battery Polarity - Reverse

9 - loopback test.

a - tone test.

t - Toggle to the next interface

/mnt/modules #

Page 160: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 161

The further explanation is in

vTSP_HW_1_3_0_Reference_Manual.pdf

Page 161: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 162

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in vapp_init.c

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

Q&A

Page 162: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 163

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

Event / CMD Queue

D

E

C

O

D

E

R

muLaw

Linear

Converter

Jitter

Buffer

(vTSP)

Voice Telephony Signal Processing FIFO

Echo

Canceller

Encoder

linear

mu law

Converter

SW Gain

Controller

Caller-ID

Engine

CMD

Engine

Event

Engine

Peer

/

Local

Mixer

Ring

Engine

Noise

Floor

Generator

Comfortable

Noise

Encoder

Echo

Estimator

ve_gpl_osal_kernel.ko

ve_vtsp_rt.ko

Application

3: VTSP_start

2: VTSP_init

1: OSAL_init

ve_gpl_osal_kernel.ko

ve_vtsp_rt.ko

Control

Status

voice

C

O

D

E

C

/

S

L

I

C

(VHW)

Voice

Hardware

Interface

(TIC)

Telephony

Interface

Control

Launch vPort

1 byte / 125 us

80 bytes per 10 ms

1: insmod ve_gpl_osal_kernel.ko

2: insmod ve_osal_kernel.ko

3: insmod ve_vtsp_hw.ko

4: insmod ve_vtsp_rt.ko

5: ./Application

ve_osal_kernel.ko ve_osal_kernel.ko

Application 1: OSAL_init

2: _VAPP_initSetupSystem

3: VAPP_vtspStart

(VTSP_init, VTSP_start)

4: VAPP_mgmtInit

5: VAPP_sipStart

6: _VAPP_initCreateQueues

7: _VAPP_initStartTasks

Page 163: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 164

Step by Step in vapp_init.c vint VAPP_main(…)

{

….

if (OSAL_FAIL == OSAL_init()) {

….

}

….

if (VAPP_OK != _VAPP_initSetupSystem(…)) {

….

}

….

if (VAPP_OK != VAPP_vtspStart(…)) {

….

}

….

if (VAPP_OK != VAPP_mgmtInit(…)) {

….

}

….

if (VAPP_OK != VAPP_sipStart(…)) {

….

}

….

if (VAPP_OK != _VAPP_initCreateQueues(…)) {

….

}

….

if (VAPP_OK != _VAPP_initStartTasks(…)) {

….

}

….

}

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FSM

GUI vport_cfg.txt

VAPP_vtspEventsTask VAPP_sipNetworkInterfaceTask VAPP_sipErrorHandlerTask

VAPP_sipUaHandlerTask

VAPP_sipUaHandlerTask

VAPP_sipUaHandlerTask

….

Page 164: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 165

VoIP Configuration via vport_cfg.txt

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FSM

GUI vport_cfg.txt sipluport 5060

sipdomain 172.16.0.173

sipproxy sip:172.16.0.173

sipregis sip:172.16.0.173

siprealm 3CXPhoneSystem

regtime 3600

dname00 102

uname00 102

authname0 102

authpass0 102

rtpport 11000

t711a 8

t721 2

t729 18

tcn 0

tdtmfr 101

prefcoder 18

region us The further explanation is in

vPort_1_3_0_Configuration_Interface.pdf

Page 165: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 166

vPort Management Remote

Voice Application

Voice Signaling

Protocol

(SIP)

vTSP (DSP Algorithms,

Voice Packetization, RTP/

RTCP, Jitter Buffer)

O/S Adaptation Layer

Audio/Telephone

Interface DriverIP Stack, NAT

O/S

Soc Processor

FSM

GUI vport_cfg.txt

Page 166: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 167

Step by Step in VAPP_vtspEventsTask vint VAPP_vtspEventsTask (…)

{

….

_VAPP_VTSP_EVENT_TASK_LOOP:

if (VTSP_OK == VTSP_getEvent(…)) {

….

if (VTSP_INFC_GLOBAL == event.infc) {

….

}

else if (VTSP_EVENT_MSG_CODE_HOOK == event.code) {

….

}

else if (VTSP_EVENT_MSG_CODE_TONE_GENERATE == event.code) {

….

}

….

}

if (send) {

if (VTSP_INFC_GLOBAL == event.infc) {

….

OSAL_msgQSend(….)

….

}

else if (event.infc < VAPP_INFC_NUM) {

….

OSAL_msgQSend(….)

….

}

}

goto _VAPP_VTSP_EVENT_TASK_LOOP;

}

VAPP_sipNetworkInterfaceTask

VAPP_sipUaHandlerTask

Page 167: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 168

Step by Step in VAPP_sipUaHandlerTask

vint VAPP_sipUaHandlerTask (…)

{

….

__VAPP_SIP_UA_HANDLER_TASK_LOOP:

if ((n = OSAL_msgQGrpRecv (…)) > 0) {

….

if (ua_ptr->sipQ == fromQ) {

….

}

else if (ua_ptr->vtspQ == fromQ) {

_VAPP_sipEventsProcessor(…);

_VAPP_sipSendMsgToUa(…);

}

else if (ua_ptr->errQ == fromQ) {

….

}

….

}

goto __VAPP_SIP_UA_HANDLER_TASK_LOOP;

}

vint VAPP_vtspEventsTask (…)

{

….

_VAPP_VTSP_EVENT_TASK_LOOP:

if (VTSP_OK == VTSP_getEvent(…)) {

….

}

if (send) {

if (VTSP_INFC_GLOBAL == event.infc) {

….

OSAL_msgQSend(….)

….

}

else if (event.infc < VAPP_INFC_NUM) {

….

OSAL_msgQSend(….)

….

}

}

goto _VAPP_VTSP_EVENT_TASK_LOOP;

}

Run the state machine now

on the vTSP event.

Send SIP responses,

SIP invitations,

based on FSM messages.

vTSP vSIP

vAPP

FSM

vint _VAPP_sipEventsProcessor (…)

{

….

VAPP_fsmRunMaster(….);

….

}

Page 168: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 169

vApp Task Model

VAPP_sipNetworkInterfaceTask()

_VAPP_sipNetworkInfcCallBack()

UA_Entry()

VAPP_sipErrorHandlerTask()

Error Task sipQ

VAPP_sipTimerTask()

UA Task sipQ

UA_Entry()

VAPP_sipUaHandlerTask()

VAPP_vtspEventsTask()

_VAPP_sipUaHandlerCallBack()

UA Task vtspQ

FSM (events processor)

vSIP events mapper

vTSP events mapper

UA Task errQ

vSIP APIvTSP API

VSTP commands vSIP messages

VTSP events

vSIP events

VTSP_getEvent()

.....

Receiving event

from vTSP

Mapping Event from vTSP

into Event for vApp

Receiving event

from vSIP

Mapping Event from vSIP

into Event for vApp

vtsp_constant.h

typedef enum

{ VTSP_EVENT_MSG_CODE_TRACE = 0,

VTSP_EVENT_MSG_CODE_RING_GENERATE = 1,

VTSP_EVENT_MSG_CODE_RING_DETECT = 2,

VTSP_EVENT_MSG_CODE_HOOK = 3,

} VTSP_EventMsgCodes;

vtsp_manage.h

VTSP_QueryData *VTSP_query(…);

VTSP_Return VTSP_init(…);

VTSP_Return VTSP_config(…);

….

….

Page 169: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 170

Software Diagram

vSIP

vApp

vTSP / PSTN driver

OSAL KU

Queues

BSP Linux Network

BSD Sockets /

Sys Calls

Linux -

User Space

Linux -

Kernel Space

RTPPCM, Control

Control

Control

OSAL UU

Queues

Control

Control

SIP on UDP

OSAL UC Pthreads

OSAL

vPort

dev

API

Page 170: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 171

vApp Finite State Machine

Master

FSM

Slave 1

FSM

Slave 2

FSM

evt1

evt2

sMsg1,

call1,

tone1

call1

sMsg2,

call2,

tone2

focus,

ring,

cwOutputs

Input events

call2

Page 171: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 172

Step by Step in Master FSM 1

Page 172: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 173

Step by Step in Master FSM 2

Page 173: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 174

Step by Step in Slave FSM

VAPP_IDEL_S

VAPP_DT_S

VAPP_DACCM_S VAPP_DIALING_S

VAPP_RINGBACK_S

VAPP_TALKING_S

VAPP_BSYT_S

VAPP_FBSYT_S VAPP_TKYT_S VAPP_SIL_S

VAPP_TRYING_S

evt==VAPP_RESET_E

sMsg=VAPP_SREG_M;

tone=0;

call='0';

accm='0';

evt==VAPP_DIAL_E

sMsg=0;

tone=VAPP_TONE_DIAL_A;

evt==VAPP_DTMFLE_E

sMsg=0;

tone=VAPP_TONE_SIL_A;

accm='1';

evt==VAPP_MATCH_E

sMsg=VAPP_SINV_M;

accm='0';

evt==VAPP_SANS_E

sMsg=VAPP_SRBANS_M;

tone=0;

call='1';

evt==VAPP_SRING_E

sMsg=0;

tone=VAPP_TONE_RB_A

evt==VAPP_SANS_E

sMsg=VAPP_SRBANS_M;

tone=0;

call='1';

(evt==VAPP_SERR_E) OR

(evt==VAPP_SDISCN_E)

OR (evt==VAPP_RBTMO_E)

sMsg=VAPP_SDISCN_M;

tone=VAPP_TONE_FBSY_A;

(evt==VAPP_SDISCN_E)

OR (evt==VAPP_SBUSY_E)

sMsg=VAPP_SDISCN_M;

tone=VAPP_TONE_BSY_A

evt==VAPP_BSYTMO_E

sMsg=0;

tone=VAPP_TONE_TKY_A;

evt==VAPP_FBSYTMO_E

sMsg=0;

tone=VAPP_TONE_TKY_A

evt==VAPP_TKYTMO_E

sMsg=0;

tone=VAPP_TONE_SIL_A;

evt==VAPP_SERR_E

sMsg=VAPP_SDISCN_M;

call='0';

tone=VAPP_TONE_FBSY_A;

evt==VAPP_CNCT_E

sMsg=VAPP_SANS_M;

call='1'; evt==VAPP_SINVITE_E

sMsg=VAPP_SRING_M

(evt==VAPP_DISCN_E)

OR (evt==VAPP_SDISCN_E)

OR (evt==VAPP_SERR_E)

sMsg=VAPP_SDISCN_M

evt==VAPP_DISCN_E

sMsg=0;

tone=0;

Condition

Output VAPP_SREG_M

for SIP-Register

VAPP_IDEL_S

evt==VAPP_SDISCN_

sMsg=VAPP_SDISCN_M;

call='0';

tone=0;

Page 174: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 175

Agenda Introduction of VoIP

VoIP configuration with vport_cfg.txt

What is vPort

vPort architecture

vApp architecture

Step by Step in vapp_init.c

vTSP – SoftDSP

Telephony Driver – VHW / TIC

vAPP Task Model

Step by Step in vapp_init.c

Step by Step in VAPP_vtspEventsTask

Step by Step in VAPP_sipUaHandlerTask

Software Diagram among vSIP, vApp and vTSP

Step by Step in Master FSM 1

Step by Step in Master FSM 2

Step by Step in Slave FSM

Life-Cycle of SIP packet in vSIP and vApp

Code Trace for Phone_Pickup + Number_Dialing + SIP_Invite

Code Trace for receiving SIP_Invite

SIP packet among Callee, Caller and SIP Server

Q&A

Page 175: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 176

Module layout of vSIP

VAPP_sipNetworkInterfaceTask()

_VAPP_sipNetworkInfcCallBack()

UA_Entry()

VAPP_sipErrorHandlerTask()

Error Task sipQ

VAPP_sipTimerTask()

UA Task sipQ

UA_Entry()

VAPP_sipUaHandlerTask()

VAPP_vtspEventsTask()

_VAPP_sipUaHandlerCallBack()

UA Task vtspQ

FSM (events processor)

vSIP events mapper

vTSP events mapper

UA Task errQ

vSIP APIvTSP API

VSTP commands vSIP messages

VTSP events

vSIP events

VTSP_getEvent()

SIP Stack

Database

Module

Core Package

U.A. Package

General

Module

Debug

Logging

C Lib

Token

VoIP Net

Double

Linked List

Timers

Transport

Parser

Transation

SDP

HFDB

Transation Unit (TU)

Dialog

Session

Authentication

User Agent

( UA )

Head

Field table

EPDB

Attr’s

Table

Page 176: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 177

Data-Path Flow in SIP protocol

Local SIP Device

( Receptionist )

Remote SIP Device

( IP Phone recv page )

Page 177: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 178

Client-side Data Path

Local SIP Device

( Receptionist )

Remote SIP Device

( IP Phone recv page )

IP Stack

Transport

INV

ITE

100 (T

ryin

g)

200 (O

K)

AC

K

Parser

Parser Encoder Parser Decoder

Client Transaction

User-Agent Client Side

Dialog

(Early) (Confirmed)

EPDB

FSM

Session

(‘Offer’) (‘Answer’)

UA_MakeCall( ) UA_NotifyApp( )

event = eUA_ANSWERED

The further explanation is in

Chapter 7.1 of SipDesignDoc.pdf UA

Thread

Page 178: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 179

Code Trace for

Pickup + Dialing + SIP-Invite vint VAPP_vtspEventsTask (…)

{

….

if (VTSP_OK == VTSP_getEvent(…)) {

….

else if (VTSP_EVENT_MSG_CODE_HOOK == event.code) {

switch (event.msg.hook.reason) {

case VTSP_EVENT_HOOK_SEIZE:

msg.evt = VAPP_SEIZE_E;

send = 1;

break;

….

}

….

}

….

}

1

void _VAPP_fsmMReleaseState(…)

{

….

case VAPP_SEIZE_E:

evt[0] = VAPP_DIAL_E;

focus = VAPP_FSM_FOCUS_0;

….

}

2

vint VAPP_vtspEventsTask (…)

{

….

if (VTSP_OK == VTSP_getEvent(…)) {

….

else if (VTSP_EVENT_MSG_CODE_TONE_DETECT == event.code) {

if (VTSP_DETECT_DTMF == event.msg.toneDetect.detect) {

switch (event.msg.toneDetect.edgeType) {

case VTSP_EVENT_LEADING:

msg.evt = VAPP_DTMFLE_E;

msg.arg[0] = event.msg.toneDetect.tone;

send = 1;

break;

….

}

….

}

….

}

3

void _VAPP_fsmMSeizeState(….)

{

….

case VAPP_DTMFLE_E:

case VAPP_DTMFTE_E:

digTmr = 0;

/*

* Pass on DTMF detections to slave.

*/

if (VAPP_FSM_FOCUS_0 == focus) {

evt[0] = evtm;

}

….

}

4

void _VAPP_fsmSDtState (….)

{

….

case VAPP_DTMFLE_E:

tone = VAPP_TONE_SIL_A;

sNxt = VAPP_S_DACCM_S;

accm = 1;

tmr = 0;

break;

….

}

5

void VAPP_fsmRunSlave (….)

{

….

case VAPP_S_DACCM_S:

_VAPP_fsmSDaccmState (obj_ptr, evt);

break;

….

}

6

Page 179: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 180

Code Trace for

Pickup + Dialing + SIP-Invite void _VAPP_fsmSDaccmState (….)

{

….

case VAPP_TIMER_E:

tmr++;

….

if (VAPP_FSM_DACCMTMO_ID == tmr || fDil == 1) {

sMsg = VAPP_SINV_M;

sNxt = VAPP_S_DIALING_S;

tmr = 0;

accm = 0;

fDil = 0;

}

break;

case VAPP_DTMFTE_E:

….

tmr = 0;

break;

….

}

7

vint VAPP_fsmRunMaster(…)

{

….

/*

* Collect digits if required.

*/

_VAPP_fsmCollectDigits (obj_ptr, evt, arg);

….

}

8

vint VAPP_fsmRunSlave(…)

{

….

case VAPP_S_DIALING_S:

_VAPP_fsmSDialingState (obj_ptr, evt);

break;

….

}

9

void _VAPP_sipSendMsgToUaSlave(…)

{

….

case VAPP_SINV_M:

….

call_ptr = _VAPP_sipInsertCallFromFsm(ua_ptr, slave, peerUri_ptr);

break;

….

}

10

VAPP_CallObj *_VAPP_sipInsertCallFromFsm(…)

{

….

call_ptr->dialog_ptr = UA_MakeCall(

ua_ptr->sipUa_ptr,

(char *)call_ptr->uri,

ua_ptr->uaConfig.aor[0].szUri,

ua_ptr->displayName[0],

pHdrFlds, numHdrFlds,

&call_ptr->lclSessParams,

&ua_ptr->localIpConn);

….

}

11

Page 180: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 181

Code Trace for

Pickup + Dialing + SIP-Invite

tSipHandle UA_MakeCall(….)

{

….

/* run it through the state machine */

if (UASM_DialogClient(pDialog, pMsg, NULL) != SIP_OK) {

….

goto errorExit;

} ….

}

12

vint UASM_DialogClient(….)

{

….

pfClient = _UASM_ClientTable[pMsg->msgType][pDialog->currentState][method];

if (pfClient) {

return pfClient(pDialog, pMsg, hTransaction);

}

} 13

static vint _UASM_ErlyClientInviteReq(…)

{

….

return UA_SendRequest((tUa*)pDialog->hOwner, DIALOG_GetUri(pDialog, pMsg),…);

} 14

vint UA_SendRequest(…)

{

….

return _SendRequest2Target (pUa, pUri, hOwner,….);

}

15

static vint _SendRequest2Target(…)

{

….

return TU_SendRequest (&uri, NULL, pMsg, pfApp, hOwner, pUa->taskId,….);

} 16

vint TU_SendRequest(…)

{

….

if ((status = TRANSPORT_Send (hTransport, pMsg)) == SIP_OK) {

SIP_freeMsg(pMsg);

}

….

}

17

vint TRANSPORT_Send(…)

{

….

status = TRANSDRVR_UdpSend (pTrans, pBuffer, bufferLen);

….

}

18

vint TRANSDRVR_UdpSend(…)

{

….

ret = OSAL_netSocketSendTo (&fd, pData, &numSent, &addr);

….

}

19

Page 181: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 182

Server-side Data Path

Local SIP Device

( Receptionist )

Remote SIP Device

( IP Phone recv page )

IP Stack

Transport

INV

ITE

100 (T

ryin

g)

200 (O

K)

AC

K

Parser

Parser Decoder Parser Encoder

Transaction

Dialog

(Early) (Confirmed)

Session

(‘Create’) (‘Update’)

S.M.

Transaction (Server Side)

Transport

User-Agent Server

Parser

Encoder Decoder

Dispatcher

UA

Thread

The further explanation is in

Chapter 7.2 of SipDesignDoc.pdf UA_NotifyApp( )

event = eUA_CALL_ATTEMPT

UA_Answer( )

Network

Interface

Thread

Page 182: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 183

Code Trace for receving a SIP-Invite void TRANSDRVR_Recv(void)

{

….

if (OSAL_SUCCESS != OSAL_netSocketReceiveFrom(&fd, _pBuffer,….)) {

bytesRead = 0;

}

….

if ( _Decode(&pMsg, _pBuffer, bytesRead) == SIP_OK) {

_TransCallBack (pMsg, &rmtConn, &lclConn, type);

}

….

}

1

static vint _TransCallBack (…)

{

….

if (pMsg->msgType == eSIP_REQUEST) {

….

status = pfTransServerCb (type, pLclConn, pRmtConn, pMsg);

}else {

….

}

….

}

2

vint UAS_TrafficCB(…)

{

….

hTransaction = _UA_ServerBuildResources (hContext, pUa,….);

if (hTransaction) {

/* all is well so distribute */

return _ServerDispatch(pUa, pMsg, hTransaction);

}

….

}

3

static vint _UA_Server(…)

{

….

switch (event) {

case eTU_REQUEST:

/* send it to the appropriate handler */

if ((status = _UA_Send2Method (hOwner, pMsg, hTransaction)) != SIP_OK) {

….

}

….

}

4

static vint _UA_Send2Method(…)

{

….

if (method >= eSIP_INVITE && method < eSIP_LAST_METHOD) {

pfMethod = _UA_ServerHandlers[method];

if (pfMethod) {

status = pfMethod (hOwner /*or UA */, pMsg, hTransaction);

}

….

}

5

vint UAS_Invite(…)

{

….

bindDialog:

/* bind the trans to the dialog */

pDialog->hTrans = hTransaction;

/* Now drive through the S.M. */

status = UASM_DialogServer(pDialog, pMsg, hTransaction);

….

}

6

vint UASM_DialogServer(…)

{

….

pfServer = _UASM_ServerTable[pMsg->msgType][pDialog->currentState][method];

if (pfServer) {

return pfServer (pDialog, pMsg, hTransaction);

}

….

}

7

static vint _UASM_ConfServerInviteReq(…)

{

….

UA_NotifyApp(pDialog->hOwner, pDialog, eUA_MEDIA_INFO, pMsg, NULL);

….

} 8

void UA_NotifyApp(…)

{

….

if (pUa->pfAppCb) {

pUa->pfAppCb (pUa->taskId, pUa, pDialog, event, &e);

} ….

} 9

Page 183: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 184

vint _VAPP_sipUaHandlerCallBack(…)

{

….

/*

* Send SIP responses, invitations, based on FSM messages.

*/

_VAPP_sipSendMsgToUa (ua_ptr, arg_ptr);

return (SIP_OK);

}

10

void _VAPP_sipSendMsgToUa(…)

{

….

_VAPP_sipSendMsgToUaSlave (ua_ptr, arg_ptr, call_ptr….);

} 11

void _VAPP_sipSendMsgToUaSlave(…)

{

….

case VAPP_SMEDIA_M:

if (0 == arg_ptr->resp.respCode) {

UA_Answer (ua_ptr->sipUa_ptr, call_ptr->dialog_ptr,….);

}

} 12

Code Trace for receving a SIP-Invite

Page 184: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 185

Relation of Application Events, SIP API and SIP messages

UA UA Application Application

Phone Ringing

Ring

Phone Line

Dialtone

Is Generated

To the Phone

Media Stream

RTP Stream

Is Created RTP Stream

Is Created

Phone

Hangs Up

Ringback

Tone

Is Created

To the

Phone Line

SIP Endpoint ‘A’ SIP Endpoint ‘B’

Page 185: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 186

Client-side view of Transport function layout

IP Stack

Application

UA_MakeCall( )

TRANSPORT_ClientAlloc( )

TRANSACTION_ClientCreate( )

TRANSPORT_Send( )

INVITE 180 Ringing

TRANSPORT_StartServer( )

TRANSDRVR_Recv( )

UAS_TrafficCB( ) UAC_TrafficCB( )

UA Thread Network

Interface Thread

Dispatch Message to

UA thread

Requests Responses

UA_MakeCall( )

UA_ANSWER( )

UA_HangUp( )

UA_Register( )

UA_NotifyResp( )

UA_ModifyCall( )

UA_Options( )

UA_Transfer( )

….

sip_ua.h

UAC_Invite( )

UAC_ReInvite( )

UAC_Update( )

UAC_Refer( )

UAC_Notify( )

UAC_Subscribe( )

UAC_Message( )

UAC_Info( )

….

sip_client_ua.h

UAS_Invite( )

UAS_Bye( )

UAS_Cancel( )

UAS_Options( )

UAS_Register( )

UAS_Ack( )

UAS_Refer( )

UAS_Notify( )

….

sip_server_ua.h

Page 186: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 187

RFC 3264

RFC3264 An Offer/Answer Model with the Session Description Protocol (SDP) for negotiation

The Session module implements the “Offer-Answer” media stream negotiation model as defined in [8]. When considering both [8] and [2], two different handshakes mechanisms to exchange SDP information are concluded.

They are as follows.

An “offer” MUST be in an INVITE request and the “answer” MUST be in a 200 (OK) response.

The “answer” can also be in a 1xx response but it MUST be the same

information that will be found in the 200 (OK) response.

--OR--

The “offer” can be in a 200 (OK) response and the “answer” in the ACK.

The offer is considered to be the SDP information first sent, while the answer is the SDP information that was returned if the offer was accepted.

Page 187: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 188

Making an Offer

UA_MakeCall( )

DIALOG_InitClient( )

SESSION_Init( )

SESSION_MakeOffer( )

UASM_DialogClient( )

Send SIP Invite request

To SIP core

• Create INVITE Request

• Populate Request with data from EPDB

• Init a Dialog

• Save pieces of state

• Set state of Dialog

• Set “coder types” from EPDB in tSession

• Set the packet rate from EPDB in tSession

• Set the name of the endpoint in tSession

• Create SDP Object

• Populate SDP msg with data listed from above

• Attach SDP info to INVITE request

• Set State Dialog

• Create Transaction

Page 188: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 189

Making, Updating an Answer

UAC_Invite( )

UASM_DialogClient( )

SESSION_UpdateAnswer( )

UA_NotifyApp( )

•The response is matched to a transaction and hence a dialog

• Update UA state

• Prepare ACK request and send

• Set active coder

• Set remote IP address and Port

• Send eUA_ANSWERED event message to application

UAS_Invite( )

UA_SearchDialogs( )

DIALOG_InitServer( )

UASM_DialogServer( )

SESSION_NegotiateOffer( )

UA_NotifyApp( )

• entry point into the INVITE server-side behavior

• No current Dialog is found so initialize one

• Set pieces of state based on data in request

• Set remote IP addr and Port

• Negotiate Packet rate

• Negotiate coder type in SDP with ones in local tSession object

• Set connection duplexity

• Create SDP message to be later included in the 200 (OK) Resp

• Search all active Dialogs to see a dialog already exist for this request

• Update state of Dialog

• Send eUA_CALL_ATTEMPT event message to application

incom

ing IN

VIT

E

Request fro

m

SIP

core

1: When an “offer” is received, the UA has to generate an “answer”.

2: The session interface has toperform a negotiation, or

3: decide which coder type to use

4: from the list of available coder typedefined in the “offer”.

1: The Session needs to be updated

2: when a 200(OK) response is returned.

3: The 200 (OK) response will contain the “answer” to the “offer”

4: that was sent with the original INVITE request.

Page 189: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 190

Dialog in SIP Protocol Dialogs are a concept in SIP that represents a conversation between two endpoints.

The dialog module consists of the following features.

1: Maintenance of pieces of state needed when a dialog is being set up

2: Maintenance of pieces of state needed when dialog is active

3: Helper functions to help populate requests and responses based on the state of the dialog and the

appropriate pieces of state

In other word

Dialog is a Data Structure with essential information for conversation management

Page 190: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 191

State of Dialog

1: Client-side Dialog Creation (Early State) If the following header fields found in the INVITE request message, an Dialog should be create in order to manage the

following SIP operation.

Request-URI

Via list

To

From

Route List (optional)

2: Server-side Dialog Creation (Early State) When the Server-side dialog receives an INVITE request, a Dialog will be created to store essential information in order to

manage the following SIP operation

3: Client-side Dialog Updating (Confirmed State) When the Client-side dialog receives a 200 (OK) response to the original INVITE request,

members of the dialog object are updated and the state of the dialog transitions to the “Confirmed”

state.

4: Server-side Dialog Updating (Confirmed State) The Server-side dialog transitions to the confirmed state as soon as a 200 (OK) response is

generated and passed through the dialog module.

Page 191: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 192

tUa *UA_Alloc(uint8 numDialogs)

{

EPDB_Empty(pUa->epdb);

SIP_bzero((char*)&pUa->lclConn, sizeof (tLocalIpConn));

SIP_bzero((char*)pUa->dialogList.pDialogs, (sizeof(tSipDialog) * pUa->dialogList.numDialogs));

}

tSipHandle UA_Create(tUaConfig *pConfig)

{

….

pUa = UA_Alloc(numDialogs);

….

if (!(hTrans = TRANS_ClientCreate(hTransport, TRANSPORT_Send, … (tSipHandle)taskId)))

….

}

tSipHandle TRANS_ClientCreate(…)

{

….

if (!(pTrans = (tTrans*)SIP_malloc(sizeof(tTrans))))

….

if (pTrans->method == eSIP_INVITE) {

pTrans->pfState = _InviteClientSM;

else {

pTrans->pfState = _MethodClientSM;

}

}

IP Stack

Transport

INV

ITE

100 (T

ryin

g)

200 (O

K)

AC

K

Parser

Parser Encoder Parser Decoder

Client Transaction

User-Agent Client Side

Dialog

(Early) (Confirmed)

EPDB

FSM

Session

(‘Offer’) (‘Answer’)

UA_MakeCall( ) UA_NotifyApp( )

event = eUA_ANSWERED

UA

Thread

Page 192: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 193

Transaction state machine for Client INVITE Requests

pTrans->state ==

eTRANS_CALLING

pTrans->state ==

eTRANS_PROCEEDING

pTrans->state ==

eTRANS_COMPLETED

pTrans->state ==

eTRANS_TERMINTED

TRANS_ClientCreate( )

Recv’d

1xx

Pro

vis

ional R

esp

Recv’d

300 ~

699

Fin

al R

esp

Tim

er D

“Wait fo

r Resp”

expire

d

(Afte

r 32 s

econds)

Timer A

Resend “INVITE”

(after 200ms)

Recv’d 1xx

provisional resp

Recv’d 300~699

Final resp

Recv’d 300~699

Final resp

Timer B

“Time to live” expired

(after 20 seconds)

Transport

Error

Recv’d 2xx

Final resp

Recv’d 2xx

Final resp Transport

Error

Page 193: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 194

Transaction State Machine for Client Requests

other than INVITE

pTrans->state ==

eTRANS_TRYING

pTrans->state ==

eTRANS_PROCEEDING

pTrans->state ==

eTRANS_COMPLETED

pTrans->state ==

eTRANS_TERMINTED

TRANS_ClientCreate( )

Recv’d

1xx

Pro

vis

ional R

esp

Recv’d

300 ~

699

Fin

al R

esp

Tim

er K

“Wait fo

r Resp”

expire

d

(Afte

r 5 s

econds)

Timer E

Resend Request

(after T1 expires)

Recv’d 1xx

provisional resp

Timer E

Resend Request

(After T1)

Recv’d 200~699

Final resp

Transport

Error

Transport Error or

Timer F “time to live” expired

(After 32 seconds)

Transport Error or

Timer F “time to live” expired

(After 32 seconds)

Page 194: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 195

Transaction State Machine for INVITE Server Requests

pTrans->state ==

eTRANS_PROCEEDING

pTrans->state ==

eTRANS_COMPLETED

pTrans->state ==

eTRANS_CONFIRMED

pTrans->state ==

eTRANS_TERMINTED

TRANS_ServerCreate( )

Recv’d

300~

600

Resp fro

m T

U

Recv’d

An A

CK

Repuest

Tim

er I “W

ait fo

r any

extra

AC

K’s

” expire

d

(Afte

r 5 s

econds)

Recv. duplicate INVITE Req.

Re-send last Resp

Recv. duplicate INVITE Req.

Re-send last Resp

Transport

Error

Transport Error

OR

Recv. 2xx resp from the TU

Timer H expired

OR

Transport Error

pMsg->method == INVITE

Recv. 101-199 Resp from TU.

Forward resp to transport

Timer G expired

(after 5 seconds).

Re-send last resp from TU

Page 195: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 196

State Machine for non-INVITE Server Requests

pTrans->state ==

eTRANS_TRYING

pTrans->state ==

eTRANS_PROCEEDING

pTrans->state ==

eTRANS_COMPLETED

pTrans->state ==

eTRANS_TERMINTED

TRANS_ServerCreate( )

Recv’d

1xx

Resp fro

m T

U

Recv’d

200~

699

Fro

m T

U

(final re

sp)

Tim

er J

(afte

r 32 s

econds)

“Wait fo

r any e

xtra

AC

K’s

Recv. duplicate Req.

Re-send last Resp

Transport

Error

Recv 200-699 Resp

from TU

pMsg->method == BYE

Recv 1xx resp

from TU

Transport

Error

Recv. duplicate Req.

Re-send last Resp

Page 196: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 197

vApp Task Model

VAPP_sipNetworkInterfaceTask()

_VAPP_sipNetworkInfcCallBack()

UA_Entry()

VAPP_sipErrorHandlerTask()

Error Task sipQ

VAPP_sipTimerTask()

UA Task sipQ

UA_Entry()

VAPP_sipUaHandlerTask()

VAPP_vtspEventsTask()

_VAPP_sipUaHandlerCallBack()

UA Task vtspQ

FSM (events processor)

vSIP events mapper

vTSP events mapper

UA Task errQ

vSIP APIvTSP API

VSTP commands vSIP messages

VTSP events

vSIP events

VTSP_getEvent()

.....

Receiving event

from vTSP

Mapping Event from vTSP

into Event for vApp

Receiving event

from vSIP

Mapping Event from vSIP

into Event for vApp

sip_ua.h

typedef enum eUaEvtType{

eUA_RESPONSE,

eUA_ERROR,

eUA_RINGING,

eUA_LAST_EVENT,

}tUaEvtType;

sip_ua.h

tSipHandle UA_Create(…);

vint UA_Modify(…);

tSipHandle UA_MakeCall(…);

….

Page 197: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 198

vSIP: D2 SIP (IETF) stack Supported SIP RFCs*

RFC3261 SIP: Session Initiation Protocol

RFC2327 SDP: Session Description Protocol

RFC3262 Reliability of Provisional Responses in SIP

RFC3263 Locating SIP Servers

RFC3264 An Offer-Answer Model with SDP

RFC3265 Specific Event Notification

RFC3515 The SIP Refer Method

RFC3428 SIP Extension for Instant Messaging

RFC3856 A Presence Event Package for SIP

RFC3581 An Extension to the SIP for Symmetric Response Routing

RFC3891 The SIP "Replaces" Header

RFC3842 A Message Summary and Message Waiting Indication Event Package for SIP

RFC3325 Private Extensions to the SIP for Asserted Identity within Trusted Networks

RFC2617 HTTP Authentication: Basic and Digest Access Authentication

RFC2976 The SIP INFO Method

RFC3311 The SIP UPDATE Method

RFC4028 Session Timers in SIP

*Contact D2 for most current list

Page 198: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 199

SIP packet among Callee, Caller and SIP Server

SIP Server

SIP_Proxy style

SIP Endpoint A SIP Endpoint B

Step1:

Create (Username, Password) for A

Here is (100 , 100 )

Create (Username, Password) for B

Here is (101 , 101 )

IP: 172.16.60.1

Realm: 3CXPhoneSystem

IP: 172.16.60.100 IP: 172.16.60.200

sipluport 5060

sipdomain 172.16.60.1

sipproxy sip:172.16.60.1

sipregis sip:172.16.60.1

siprealm 3CXPhoneSystem

regtime 3600

dname00 100

uname00 100

authname0 100

authpass0 100

rtpport 11000

t711a 8

t721 2

t729 18

tcn 0

tdtmfr 101

prefcoder 18

region us

Step 2: modify vport_cfg.txt

sipluport 5060

sipdomain 172.16.60.1

sipproxy sip:172.16.60.1

sipregis sip:172.16.60.1

siprealm 3CXPhoneSystem

regtime 3600

dname00 101

uname00 101

authname0 101

authpass0 101

rtpport 11000

t711a 8

t721 2

t729 18

tcn 0

tdtmfr 101

prefcoder 18

region us

Step 2: modify vport_cfg.txt

Step 3: launch vPort Step 3: launch vPort

Step 4:

vPort send SIP-Register

to SIP Server

Step 4:

vPort send SIP-Register

to SIP Server

Step 5:

5.1: SIP Server receive SIP-Register

from A and B respectively

5.2: SIP Server check Username and

password for A and B accordingly

5.3: the result of step 5.2 is OK

5.4: send SIP-OK to A and B

respectively SIP-Register SIP-Register

SIP-Status: 200 OK (1 Bindings)

SIP-Status: 200 OK (1 bindings)

SIP-Status: 407-Proxy Authentication Required (0 Bindings)

SIP-Register SIP-Status: 407-Proxy Authentication Required (0 Bindings)

SIP-Register

Page 199: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 200

SIP packet among Callee, Caller and SIP Server

SIP Server

SIP_Proxy style

SIP Endpoint A SIP Endpoint B

IP: 172.16.60.1

Realm: 3CXPhoneSystem

IP: 172.16.60.100 IP: 172.16.60.200

SIP-Request: Invite SIP:102@...

SIP-Status: 407 Proxy Authentication Required

SIP-Request: Ack

SIP-Request: Invite SIP:102@...

SIP-Request: Invite SIP:102@...

SIP-Status: 100 Trying

SIP-Status: 100 Trying

SIP-Status: 180 Ringing

SIP-Status: 180 Ringing

SIP-Status: 200 OK

SIP-Request: Ack

SIP-Status: 200 OK

SIP-Request: Ack

SIP-Request: Bye SIP:100@...

SIP-Status: 200 OK SIP-Request: Bye SIP:100@...

SIP-Status: 200 OK

Step 6:

6.1: User pick up phone

and dial number of B

6.2: vPort send SIP-Invite

to SIP Server

Step 7:

Someone pick up phone

Step 8:

Someone on-hook phone

Page 200: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 201

vPort-GW 1.3 Feature List

Protocols

RTP RFC 3550 & 3551

SIP RFC 3261 & 2543

SIP PRACK (RFC3262)

SIP RFC 3263

SDP RFC 3264 &2327

SIP RFC 3265

SIP UPDATE (RFC 3311)

SIP RFC 3428

SIP REFER (RFC 3515)

SIP RFC 3581

SIP RFC 3605

SIP RFC 3842

SIP RFC 3891

SIP RFC 4028

SIP INFO (RFC 2976)

SIP RFC 2617

SIP RFC 3611

STUN (RFC 3489)

> 1 UA login

DSP Software (vTSP)

G711 A/u-law,

G729AB

G726-32K

G.723.1A *

iLBC *

G.168 16-48ms tail LEC

Packet Loss Compensation

Silence Compression

DTMF Tone Generation

DTMF Tone Detection

DTMF Relay (RFC2833)

Call Progress Tones

Type 1 and Type 2 Caller ID Generation (FXS) US, Japan, ETSI

Dynamic Adaptive Jitter Buffer

Fax/Modem Tone Detection

Fax Pass Through: G.711

T.38 Fax Relay

3-way Calling Conference

Telephony driver

FXO Support **

Application

Codec Negotiation

Silence Suppression

Proxy calls from outside firewall

3-way call conference

DTMF relay

Speed dial

Call waiting / Caller-ID

Calls from behind firewall

Call Hold/Retrieve

Call Forwarding (Busy/NO Answer/Unconditional)

Call Return

Call Blocking

Do not disturb

Configurable Ring Pattern per Port (Ring Cadence)

Repeat dialing on busy

Call Transfer

* =Optional Feature **=Customized by Demand

Page 201: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 202

vport_cfg.txt with

vPort-GW 1.3 Feature List in Application Application

Codec Negotiation

Silence Suppression

Proxy calls from outside firewall

3-way call conference

DTMF relay

Speed dial

Call waiting / Caller-ID

Calls from behind firewall

Call Hold/Retrieve

Call Forwarding (Busy/NO Answer/Unconditional)

Call Return

Call Blocking

Do not disturb

Configurable Ring Pattern per Port (Ring Cadence)

Repeat dialing on busy

Call Transfer

sipluport 5060

sipdomain 172.16.60.1

sipproxy sip:172.16.60.1

sipregis sip:172.16.60.1

siprealm 3CXPhoneSystem

regtime 3600

dname00 100

uname00 100

authname0 100

authpass0 100

rtpport 11000

t711a 8

t721 2

t729 18

tcn 0

tdtmfr 101

prefcoder 18

region us

rdials *68

crets *69

cdnds *70

cfwds *71

planZero sip:[email protected]

cscreensm 0

cscreens00 sip:[email protected]

cscreens10 sip:[email protected]

cfwdm0 0

cfwdring 3

cfwdtime 2

cfwduri0 sip:[email protected]

ctrans *72

cidblksm 0

cidblks00 2601100

cidblks10 2708000

ringid00 1,5000,100,0,0,0,0,1

ringid01 1,5000,100,0,0,0,0,1

ringid02 1,5000,100,0,0,0,0,1

toneid00 387,470,42,42,1,100,0,60,0,0,0,0,0,0

toneid01 387,470,42,42,1,100,0,60,0,0,0,0,0,0 dials02 sip:[email protected]

dials03 sip:[email protected]

dials04 sip:[email protected]

gaintx0 0

gainrx0 0

vport_cfg.txt

Page 202: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 203

The further explanation is in

vSIP_1_3_0_Interface_Manual.pdf

&

SipDesignDoc.pdf

Page 203: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 204

Q&A

Page 204: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 205

3CX SIP Server Installation

1 2 3

4 5

6

7 8 9

Page 205: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 206

10 11

12

3CX SIP Server Installation

Page 206: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 207

Hi, 田工

D2 Tech 以前是 減少 ramdisk 的大小 來提升效能.

您可以 先用 “ df ” 看一看還有多少閒置空間

再進行ramdisk 大小的縮減.

方法如下:

Reduce the ramdisk size will increse more memory space, the application will have more memory.

Below is the procedure how to reduce the ramdisk size:

1.The original ELAN ramdisk size is 2560K,

the value is gotten from the "makemeuconfig" when we try to compile the linux kernel.

/export/a9207/kernel/make menuconfig ==> "block device" ==> Change the value to be 1536

2. the ELAN ramdisk file is "VOIP_2.5M_ramdisk_f182_uc20.gz“

gunzip VOIP_2.5M_ramdisk_f182_uc20 mount VOIP_2.5M_ramdisk_f182_uc20 mnt_old

3. Create new ramdisk with smaller size, we configure the size to be 1536 dd if=/dev/zero of=D2_new

bs=1k count=1536 /sbin/mke2fs -F -v -m0 -N 312 D2_new mount -o loop D2_new mnt_new (the

parameter "-N 312" is very important, becuase it will create more inodethan the default, otherwise, some

files can not copy into this new ramdiskalthough ramdisk has enough space)

4. copy all files in mnt_old to mnt_new

then , remove "elan" folder, we don't use it remove "vi", the file size is very big, but rare to use,

so remove it.

5. unmount mnt_new gzip -9 D2_new then, we can link D2_new with linux kernel, compile the linux

kernel andcreate a new bootpImage.

Reduce Size of Ramdisk

Page 207: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 208

Ixia Configuration

Page 208: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 209

Page 209: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 210

MHz Measurement

#if 1 //def VTSP_ENABLE_MHZ_GPIO_A9207

/*

* Define the GPIO control

*/

#define CPE_GPIO_VA_BASE 0x98700000

#define outl(val,port) { (*(volatile unsigned long *)(port)) = (val); }

#define inl(port) (*(volatile unsigned long *)(port))

/*

* GPIO17 is for BLKLED, But I take advantage of it for MHz measurement

*/

#define TIC_PIO_MHZ_NUM 17

#define TIC_PIO_DIR_INPUT(num) outl( ( (~(0x1<<(num)))|inl(_reg_DIR) ),_reg_DIR );

#define TIC_PIO_DIR_OUTPUT(num) outl( ( 0x1<<(num)|inl(_reg_DIR) ),_reg_DIR );

#define TIC_PIO_PULL_ENABLE(num) outl( ( 0x1<<(num)|inl(_reg_PULL_CTRL) ),_reg_PULL_CTRL );

#define TIC_PIO_PULL_DISABLE(num) outl( ( (~(0x1<<(num)))|inl(_reg_PULL_CTRL) ),_reg_PULL_CTRL );

#define TIC_PIO_PULL_HIGH(num) outl( ( 0x1<<(num)|inl(_reg_PULL_TYPE) ),_reg_PULL_TYPE );

#define TIC_PIO_PULL_LOW(num) outl( ( (~(0x1<<(num)))|inl(_reg_PULL_TYPE) ),_reg_PULL_TYPE );

#define TIC_PIO_DATA_SET(num) outl( ( 0x1<<(num) ),_reg_DATA_SET );

#define TIC_PIO_DATA_CLR(num) outl( ( 0x1<<(num) ),_reg_DATA_CLR );

#endif

Page 210: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 211

OSAL_TaskReturn VTSPR_task(…)

{

….

/*

* Initialize the GPIO

*/

TIC_PIO_DIR_OUTPUT(TIC_PIO_MHZ_NUM);

TIC_PIO_PULL_DISABLE(TIC_PIO_MHZ_NUM);

TIC_PIO_DATA_SET(TIC_PIO_MHZ_NUM);

….

while (0 != (VTSPR_TASK_RUN & vtspr_ptr->taskEnable)) {

/*

* Run timing function

*/

_VTSPR_time(…);

/* Get 10ms audio data, blocking function

*/

VHW_exchange(&tx_ptr, &rx_ptr);

/*

* Run CPU %Usage function

*/

_VTSPR_timeMeasure(…);

….

_VTSPR_recvAllCmd(….);

_VTSPR_genAllEvent(…);

_VTSPR_rtpRecv(…)

_VTSPR_audioRxFormat(…)

_VTSPR_audioRemoveEcho(…)

_VTSPR_audioNear(…)

_VTSPR_audioStreamDecode(…)

_VTSPR_audioConfToLocal(…)

….

….

}

}

inline void _VTSPR_timeMeasure(…)

{

….

/*

* Configure the GPIO to be HIGH

*/

TIC_PIO_DATA_SET(TIC_PIO_MHZ_NUM);

}

inline void _VTSPR_time(…)

{

….

/*

* Configure the GPIO to be LOW

*/

TIC_PIO_DATA_CLR(TIC_PIO_MHZ_NUM);

}

10ms

4.5ms

CPU: 200 MHz

So, G.729 consume

200MHz * ( 4.5 ms / 10 ms ) = 90MHz

Page 211: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 212

Schematic

GPIO17 BKLED_CTL R42

Page 212: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 213

Ground

R42

Page 213: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 214

Page 214: vTsp_1_3_1_Root

R 104

G 0

B 0

R 28

G 56

B 144

R 40

G 114

B 118

R 101

G 63

B 21

R 116

G 97

B 26

R 204

G 0

B 0

R 101

G 131

B 225

R 109

B 200

G 205

R 217

G 146

B 67

R 219

G 192

B 95

R 104

B 211

G 69

R 28

G 79

B 21

The L

eader

in R

ISC

Based V

oIP

Softw

are

2015/7/19 CONFIDENTIAL 215