Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Matt R.

Pages: [1]
Other Yate server issues / [SOLVED] External Module Communication
« on: September 28, 2017, 09:16:41 PM »
I would like to make an application that handles calls similar to an IVR but with some extra audio processing. I am having the hardest time getting external module communication to work.

This basic example from scripts/ shows the output of %%<message:<ID>:true:\n being written to stdout. It works perfectly fine, echoing the message on stderr (visible in Yate logs) and accepts a call.

Code: [Select]

read -r REPLY
echo "$REPLY" | sed 's/^[^:]*:\([^:]*\):.*$/%%<message:\1:true:/;'
echo "$REPLY" | sed 's/^[^:]*:\([^:]*\):.*$/%%<message:\1:true:/;' >&2

(sleep 1; cat) <&3 >&4

I would like to do the same thing in C, although skip piping audio from FD3 to FD4 for simplicity's' sake.

Code: [Select]
#include <stdio.h>
#include <string.h>
#include <unistd.h>

char commandBuf[4096];
char messageID[256];

int main(void) {

if( fgets(commandBuf, 4096, stdin) == NULL ) {
fprintf(stderr, "No command received.\n" );
return 1;

fprintf( stderr, "COMMAND %s\n", commandBuf); // Debug the command, logs correctly to Yate log

char* tokens = strdup(commandBuf);
char* curToken;
int curTokenIdx = 0;
while( (curToken = strsep(&tokens, ":")) != NULL ) {
fprintf(stderr, "TOKEN: %s\n", curToken ); // Tokens are correctly separated and logged

if(curTokenIdx == 1) break; // Stop when we've reached the ID


fprintf(stdout, "%%%%<message:%s:true:\n", curToken); // Send the message command to Yate
fprintf(stderr, "%%%%<message:%s:true:\n", curToken); // Log what we sent

return 0;

As far as I can tell this should work. The debug messages all indicate that the %%<message:<ID>:true: command was sent to Yate. However, I'm getting the following logs:

Code: [Select]
Sep 28 22:34:12 yate[9443]: 2017-09-28_22:34:12.933304 <extmodule:WARN> Message 0x7fca8803fdc0 'call.execute' did not return in 10000 msec [0x7fca7c0f5500]
Sep 28 22:34:12 yate[9443]: 2017-09-28_22:34:12.933413 <WARN> ExtMod 'testmodule' did not handle call message

What is causing this? My program, as far as I can tell, is outputting the exact same output as the shell script, which works just fine.

Thanks for your help.

Pages: [1]