Quantcast
Channel: Dialogic PowerMedia HMP GlobalCall and R4 API - Recent Threads
Viewing all articles
Browse latest Browse all 336

HMP 4.1: how to record voice from IP?

$
0
0

I'm running HMP 4.1 on Linux. I try to record voice data coming from a RTP endpoint (ipm device), but the record file contains only silence.

I'm not confident with functions like dev_Connect(), dx_listen() and ipm_Listen. I thought that dev_Connect would connect my ipm device to my voice device in both ways and then I could record voice received over IP with dx_rec(), but as said I only record silence.
Here is my pseudo-code, I do the following:

1. create 2 imp devices for 2 RTP endpoints
2. create 2 voice devices for play/record functions
3. connect them together
4. start media bothway of 2 IP endpoints (first endpoint sends data over IP to second endpoint, loop over IP)
5. listen on second endpoint
6. start recording on voice device 2
7. play wave file on vocie device 1

A wireshark trace shows that play is working fine, data is sent over IP to the second endpoint but I record only silence. All funtions return successfully.


long m_ipmCCH1 = ipm_Open("ipmB1C1", 0, EV_SYNC);
long m_ipmCCH2 = ipm_Open("ipmB1C2", 0, EV_SYNC);

long m_voxH1 = dx_open("dxxxB1C1", 0);
long m_voxH2 = dx_open("dxxxB1C2", 0);

dev_Connect(m_ipmCCH1, m_voxH1, DM_FULLDUP, EV_SYNC);
dev_Connect(m_ipmCCH2, m_voxH2, DM_FULLDUP, EV_SYNC);

ipm_StartMedia(m_ipmCCH1, &MediaInfo1, DATA_IP_TDM_BIDIRECTIONAL, EV_SYNC);
ipm_StartMedia(m_ipmCCH2, &MediaInfo2, DATA_IP_TDM_BIDIRECTIONAL, EV_SYNC);

sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &lVoiceTS;

dx_getxmitslot(m_voxH2, &sc_tsinfo);

sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &lLineTS;

ipm_GetXmitSlot(m_ipmCCH2, &sc_tsinfo, EV_SYNC);

sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &lVoiceTS;

ipm_Listen(m_ipmCCH2, &sc_tsinfo, EV_SYNC);

sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &lLineTS;

dx_listen(m_voxH2, &sc_tsinfo);

iott_r.io_type = IO_DEV|IO_EOT; // record to file
iott_r.io_bufp = 0;
iott_r.io_offset = 0;
iott_r.io_length = -1;
iott_r.io_fhandle = open("record.wav", O_RDWR|O_CREAT|O_TRUNC, 0666);

xpb_r.wFileFormat = FILE_FORMAT_WAVE;
xpb_r.wDataFormat = DATA_FORMAT_PCM;
xpb_r.nSamplesPerSec = DRT_8KHZ;
xpb_r.wBitsPerSample = 16;

dx_reciottdata(m_voxH2,&iott_r,NULL,&xpb_r,EV_ASYNC);

iott_p.io_type = IO_DEV|IO_EOT; // play from file
iott_p.io_bufp = 0;
iott_p.io_offset = 0;
iott_p.io_length = -1; /* play till end of file */
iott_p.io_fhandle = open("play.wav", O_RDONLY);

xpb_p.wFileFormat = FILE_FORMAT_WAVE;
xpb_p.wDataFormat = DATA_FORMAT_PCM;
xpb_p.nSamplesPerSec = DRT_8KHZ;
xpb_p.wBitsPerSample = 16;

dx_playiottdata(m_voxH,&iott_p,NULL,&xpb_p,EV_ASYNC);

What is wrong/missing?
Any idea?


Viewing all articles
Browse latest Browse all 336

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>