Asterisk - The Open Source Telephony Project  GIT-master-a24979a
Data Structures | Macros | Enumerations | Functions | Variables
app_jack.c File Reference

Jack Application. More...

#include "asterisk.h"
#include <limits.h>
#include <jack/jack.h>
#include <jack/ringbuffer.h>
#include <libresample.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/strings.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
#include "asterisk/audiohook.h"
#include "asterisk/format_cache.h"
Include dependency graph for app_jack.c:

Go to the source code of this file.

Data Structures

struct  jack_data
 

Macros

#define COMMON_OPTIONS
 Common options between the Jack() app and JACK_HOOK() function. More...
 
#define RESAMPLE_QUALITY   1
 
#define RINGBUFFER_FRAME_CAPACITY   100
 

Enumerations

enum  {
  OPT_SERVER_NAME = (1 << 0) , OPT_INPUT_PORT = (1 << 1) , OPT_OUTPUT_PORT = (1 << 2) , OPT_NOSTART_SERVER = (1 << 3) ,
  OPT_CLIENT_NAME = (1 << 4)
}
 
enum  {
  OPT_ARG_SERVER_NAME , OPT_ARG_INPUT_PORT , OPT_ARG_OUTPUT_PORT , OPT_ARG_CLIENT_NAME ,
  OPT_ARG_ARRAY_SIZE
}
 

Functions

static int alloc_resampler (struct jack_data *jack_data, int input)
 
 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "JACK Interface")
 
static struct jack_datadestroy_jack_data (struct jack_data *jack_data)
 
static int disable_jack_hook (struct ast_channel *chan)
 
static int enable_jack_hook (struct ast_channel *chan, char *data)
 
static void handle_input (void *buf, jack_nframes_t nframes, struct jack_data *jack_data)
 Handle jack input port. More...
 
static void handle_jack_audio (struct ast_channel *chan, struct jack_data *jack_data, struct ast_frame *out_frame)
 handle jack audio More...
 
static int handle_options (struct jack_data *jack_data, const char *__options_str)
 
static void handle_output (void *buf, jack_nframes_t nframes, struct jack_data *jack_data)
 Handle jack output port. More...
 
static int init_jack_data (struct ast_channel *chan, struct jack_data *jack_data)
 
static struct jack_datajack_data_alloc (void)
 
static int jack_exec (struct ast_channel *chan, const char *data)
 
static int jack_hook_callback (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
 
static void jack_hook_ds_destroy (void *data)
 
static int jack_hook_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int jack_process (jack_nframes_t nframes, void *arg)
 
static void jack_shutdown (void *arg)
 
static const char * jack_status_to_str (jack_status_t status)
 
static int load_module (void)
 
static void log_jack_status (const char *prefix, jack_status_t status)
 
static int queue_voice_frame (struct jack_data *jack_data, struct ast_frame *f)
 
static int unload_module (void)
 

Variables

static const char jack_app [] = "JACK"
 
static const struct ast_app_option jack_exec_options [128] = { [ 's' ] = { .flag = OPT_SERVER_NAME , .arg_index = OPT_ARG_SERVER_NAME + 1 }, [ 'i' ] = { .flag = OPT_INPUT_PORT , .arg_index = OPT_ARG_INPUT_PORT + 1 }, [ 'o' ] = { .flag = OPT_OUTPUT_PORT , .arg_index = OPT_ARG_OUTPUT_PORT + 1 }, [ 'n' ] = { .flag = OPT_NOSTART_SERVER }, [ 'c' ] = { .flag = OPT_CLIENT_NAME , .arg_index = OPT_ARG_CLIENT_NAME + 1 }, }
 
static const struct ast_datastore_info jack_hook_ds_info
 
static struct ast_custom_function jack_hook_function
 
struct {
   jack_status_t   status
 
   const char *   str
 
jack_status_table []
 

Detailed Description

Jack Application.

Author
Russell Bryant russe.nosp@m.ll@d.nosp@m.igium.nosp@m..com

This is an application to connect an Asterisk channel to an input and output jack port so that the audio can be processed through another application, or to play audio from another application.

ExtRef:
http://www.jackaudio.org/
Note
To install libresample, check it out of the following repository: $ svn co http://svn.digium.com/svn/thirdparty/libresample/trunk

Definition in file app_jack.c.

Macro Definition Documentation

◆ COMMON_OPTIONS

#define COMMON_OPTIONS

Common options between the Jack() app and JACK_HOOK() function.

Definition at line 67 of file app_jack.c.

◆ RESAMPLE_QUALITY

#define RESAMPLE_QUALITY   1

Definition at line 61 of file app_jack.c.

◆ RINGBUFFER_FRAME_CAPACITY

#define RINGBUFFER_FRAME_CAPACITY   100

Definition at line 64 of file app_jack.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OPT_SERVER_NAME 
OPT_INPUT_PORT 
OPT_OUTPUT_PORT 
OPT_NOSTART_SERVER 
OPT_CLIENT_NAME 

Definition at line 667 of file app_jack.c.

667  {
668  OPT_SERVER_NAME = (1 << 0),
669  OPT_INPUT_PORT = (1 << 1),
670  OPT_OUTPUT_PORT = (1 << 2),
671  OPT_NOSTART_SERVER = (1 << 3),
672  OPT_CLIENT_NAME = (1 << 4),
673 };
@ OPT_CLIENT_NAME
Definition: app_jack.c:672
@ OPT_SERVER_NAME
Definition: app_jack.c:668
@ OPT_INPUT_PORT
Definition: app_jack.c:669
@ OPT_OUTPUT_PORT
Definition: app_jack.c:670
@ OPT_NOSTART_SERVER
Definition: app_jack.c:671

◆ anonymous enum

anonymous enum
Enumerator
OPT_ARG_SERVER_NAME 
OPT_ARG_INPUT_PORT 
OPT_ARG_OUTPUT_PORT 
OPT_ARG_CLIENT_NAME 
OPT_ARG_ARRAY_SIZE 

Definition at line 675 of file app_jack.c.

675  {
680 
681  /* Must be the last element */
683 };
@ OPT_ARG_CLIENT_NAME
Definition: app_jack.c:679
@ OPT_ARG_SERVER_NAME
Definition: app_jack.c:676
@ OPT_ARG_OUTPUT_PORT
Definition: app_jack.c:678
@ OPT_ARG_INPUT_PORT
Definition: app_jack.c:677
@ OPT_ARG_ARRAY_SIZE
Definition: app_jack.c:682

Function Documentation

◆ alloc_resampler()

static int alloc_resampler ( struct jack_data jack_data,
int  input 
)
static

Definition at line 193 of file app_jack.c.

194 {
195  double from_srate, to_srate, jack_srate;
196  void **resampler;
197  double *resample_factor;
198 
200  return 0;
201 
203  return 0;
204 
205  jack_srate = jack_get_sample_rate(jack_data->client);
206 
207  to_srate = input ? jack_data->audiohook_rate : jack_srate;
208  from_srate = input ? jack_srate : jack_data->audiohook_rate;
209 
210  resample_factor = input ? &jack_data->input_resample_factor :
212 
213  if (from_srate == to_srate) {
214  /* Awesome! The jack sample rate is the same as ours.
215  * Resampling isn't needed. */
216  *resample_factor = 1.0;
217  return 0;
218  }
219 
220  *resample_factor = to_srate / from_srate;
221 
222  resampler = input ? &jack_data->input_resampler :
224 
225  if (!(*resampler = resample_open(RESAMPLE_QUALITY,
226  *resample_factor, *resample_factor))) {
227  ast_log(LOG_ERROR, "Failed to open %s resampler\n",
228  input ? "input" : "output");
229  return -1;
230  }
231 
232  return 0;
233 }
#define RESAMPLE_QUALITY
Definition: app_jack.c:61
static int input(yyscan_t yyscanner)
Definition: ast_expr2f.c:1584
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
double output_resample_factor
Definition: app_jack.c:135
void * input_resampler
Definition: app_jack.c:136
double input_resample_factor
Definition: app_jack.c:137
void * output_resampler
Definition: app_jack.c:134
unsigned int audiohook_rate
Definition: app_jack.c:132
jack_client_t * client
Definition: app_jack.c:126

References ast_log, jack_data::audiohook_rate, jack_data::client, input(), jack_data::input_resample_factor, jack_data::input_resampler, LOG_ERROR, jack_data::output_resample_factor, jack_data::output_resampler, and RESAMPLE_QUALITY.

Referenced by jack_process(), and queue_voice_frame().

◆ AST_MODULE_INFO_STANDARD_EXTENDED()

AST_MODULE_INFO_STANDARD_EXTENDED ( ASTERISK_GPL_KEY  ,
"JACK Interface"   
)

◆ destroy_jack_data()

static struct jack_data* destroy_jack_data ( struct jack_data jack_data)
static

Definition at line 343 of file app_jack.c.

344 {
345  if (jack_data->input_port) {
346  jack_port_unregister(jack_data->client, jack_data->input_port);
348  }
349 
350  if (jack_data->output_port) {
351  jack_port_unregister(jack_data->client, jack_data->output_port);
353  }
354 
355  if (jack_data->client) {
356  jack_client_close(jack_data->client);
357  jack_data->client = NULL;
358  }
359 
360  if (jack_data->input_rb) {
361  jack_ringbuffer_free(jack_data->input_rb);
363  }
364 
365  if (jack_data->output_rb) {
366  jack_ringbuffer_free(jack_data->output_rb);
368  }
369 
371  resample_close(jack_data->output_resampler);
373  }
374 
375  if (jack_data->input_resampler) {
376  resample_close(jack_data->input_resampler);
378  }
379 
382 
384 
386 
387  return NULL;
388 }
#define ast_free(a)
Definition: astmm.h:180
int ast_audiohook_destroy(struct ast_audiohook *audiohook)
Destroys an audiohook structure.
Definition: audiohook.c:121
#define NULL
Definition: resample.c:96
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:374
jack_ringbuffer_t * input_rb
Definition: app_jack.c:129
jack_port_t * output_port
Definition: app_jack.c:128
jack_ringbuffer_t * output_rb
Definition: app_jack.c:130
struct ast_audiohook audiohook
Definition: app_jack.c:142
unsigned int has_audiohook
Definition: app_jack.c:139
jack_port_t * input_port
Definition: app_jack.c:127

References ast_audiohook_destroy(), ast_free, ast_string_field_free_memory, jack_data::audiohook, jack_data::client, jack_data::has_audiohook, jack_data::input_port, jack_data::input_rb, jack_data::input_resampler, NULL, jack_data::output_port, jack_data::output_rb, and jack_data::output_resampler.

Referenced by enable_jack_hook(), jack_exec(), and jack_hook_ds_destroy().

◆ disable_jack_hook()

static int disable_jack_hook ( struct ast_channel chan)
static

Definition at line 940 of file app_jack.c.

941 {
942  struct ast_datastore *datastore;
943  struct jack_data *jack_data;
944 
945  ast_channel_lock(chan);
946 
947  if (!(datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
948  ast_channel_unlock(chan);
949  ast_log(LOG_WARNING, "No JACK_HOOK found to disable\n");
950  return -1;
951  }
952 
953  ast_channel_datastore_remove(chan, datastore);
954 
955  jack_data = datastore->data;
957 
958  /* Keep the channel locked while we destroy the datastore, so that we can
959  * ensure that all of the jack stuff is stopped just in case another frame
960  * tries to come through the audiohook callback. */
961  ast_datastore_free(datastore);
962 
963  ast_channel_unlock(chan);
964 
965  return 0;
966 }
static const struct ast_datastore_info jack_hook_ds_info
Definition: app_jack.c:826
int ast_audiohook_detach(struct ast_audiohook *audiohook)
Detach audiohook from channel.
Definition: audiohook.c:528
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2393
#define ast_channel_lock(chan)
Definition: channel.h:2922
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2398
#define ast_channel_unlock(chan)
Definition: channel.h:2923
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68
#define LOG_WARNING
Structure for a data store object.
Definition: datastore.h:64
void * data
Definition: datastore.h:66

References ast_audiohook_detach(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_free(), ast_log, jack_data::audiohook, ast_datastore::data, jack_hook_ds_info, LOG_WARNING, and NULL.

◆ enable_jack_hook()

static int enable_jack_hook ( struct ast_channel chan,
char *  data 
)
static

Definition at line 873 of file app_jack.c.

874 {
875  struct ast_datastore *datastore;
876  struct jack_data *jack_data = NULL;
878  AST_APP_ARG(mode);
880  );
881 
883 
884  ast_channel_lock(chan);
885 
886  if ((datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
887  ast_log(LOG_ERROR, "JACK_HOOK already enabled for '%s'\n", ast_channel_name(chan));
888  goto return_error;
889  }
890 
891  if (ast_strlen_zero(args.mode) || strcasecmp(args.mode, "manipulate")) {
892  ast_log(LOG_ERROR, "'%s' is not a supported mode. Only manipulate is supported.\n",
893  S_OR(args.mode, "<none>"));
894  goto return_error;
895  }
896 
897  if (!(jack_data = jack_data_alloc()))
898  goto return_error;
899 
900  if (!ast_strlen_zero(args.options) && handle_options(jack_data, args.options))
901  goto return_error;
902 
903  if (init_jack_data(chan, jack_data))
904  goto return_error;
905 
906  if (!(datastore = ast_datastore_alloc(&jack_hook_ds_info, NULL)))
907  goto return_error;
908 
912 
913  datastore->data = jack_data;
914 
916  goto return_error;
917 
918  if (ast_channel_datastore_add(chan, datastore))
919  goto return_error;
920 
921  ast_channel_unlock(chan);
922 
923  return 0;
924 
925 return_error:
926  ast_channel_unlock(chan);
927 
928  if (jack_data) {
930  }
931 
932  if (datastore) {
933  datastore->data = NULL;
934  ast_datastore_free(datastore);
935  }
936 
937  return -1;
938 }
static struct jack_data * destroy_jack_data(struct jack_data *jack_data)
Definition: app_jack.c:343
static struct jack_data * jack_data_alloc(void)
Definition: app_jack.c:693
static int handle_options(struct jack_data *jack_data, const char *__options_str)
Definition: app_jack.c:707
static int init_jack_data(struct ast_channel *chan, struct jack_data *jack_data)
Definition: app_jack.c:390
static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
Definition: app_jack.c:831
@ AST_AUDIOHOOK_MANIPULATE_ALL_RATES
Definition: audiohook.h:75
int ast_audiohook_init(struct ast_audiohook *audiohook, enum ast_audiohook_type type, const char *source, enum ast_audiohook_init_flags flags)
Initialize an audiohook structure.
Definition: audiohook.c:100
int ast_audiohook_attach(struct ast_channel *chan, struct ast_audiohook *audiohook)
Attach audiohook to channel.
Definition: audiohook.c:462
@ AST_AUDIOHOOK_TYPE_MANIPULATE
Definition: audiohook.h:38
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2384
const char * ast_channel_name(const struct ast_channel *chan)
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:85
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
ast_audiohook_manipulate_callback manipulate_callback
Definition: audiohook.h:118
const char * args
static struct test_options options

References args, AST_APP_ARG, ast_audiohook_attach(), ast_audiohook_init(), AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_AUDIOHOOK_TYPE_MANIPULATE, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strlen_zero(), jack_data::audiohook, ast_datastore::data, destroy_jack_data(), handle_options(), jack_data::has_audiohook, init_jack_data(), jack_data_alloc(), jack_hook_callback(), jack_hook_ds_info, LOG_ERROR, ast_audiohook::manipulate_callback, NULL, options, and S_OR.

◆ handle_input()

static void handle_input ( void *  buf,
jack_nframes_t  nframes,
struct jack_data jack_data 
)
static

Handle jack input port.

Read nframes number of samples from the input buffer, resample it if necessary, and write it into the appropriate ringbuffer.

Definition at line 241 of file app_jack.c.

243 {
244  short s_buf[nframes];
245  float *in_buf = buf;
246  size_t res;
247  int i;
248  size_t write_len = sizeof(s_buf);
249 
250  if (jack_data->input_resampler) {
251  int total_in_buf_used = 0;
252  int total_out_buf_used = 0;
253  float f_buf[nframes + 1];
254 
255  memset(f_buf, 0, sizeof(f_buf));
256 
257  while (total_in_buf_used < nframes) {
258  int in_buf_used;
259  int out_buf_used;
260 
261  out_buf_used = resample_process(jack_data->input_resampler,
263  &in_buf[total_in_buf_used], nframes - total_in_buf_used,
264  0, &in_buf_used,
265  &f_buf[total_out_buf_used], ARRAY_LEN(f_buf) - total_out_buf_used);
266 
267  if (out_buf_used < 0)
268  break;
269 
270  total_out_buf_used += out_buf_used;
271  total_in_buf_used += in_buf_used;
272 
273  if (total_out_buf_used == ARRAY_LEN(f_buf)) {
274  ast_log(LOG_ERROR, "Output buffer filled ... need to increase its size, "
275  "nframes '%d', total_out_buf_used '%d'\n", nframes, total_out_buf_used);
276  break;
277  }
278  }
279 
280  for (i = 0; i < total_out_buf_used; i++)
281  s_buf[i] = f_buf[i] * (SHRT_MAX / 1.0);
282 
283  write_len = total_out_buf_used * sizeof(int16_t);
284  } else {
285  /* No resampling needed */
286 
287  for (i = 0; i < nframes; i++)
288  s_buf[i] = in_buf[i] * (SHRT_MAX / 1.0);
289  }
290 
291  res = jack_ringbuffer_write(jack_data->input_rb, (const char *) s_buf, write_len);
292  if (res != write_len) {
293  ast_log(LOG_WARNING, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
294  (int) sizeof(s_buf), (int) res);
295  }
296 }
short int16_t
Definition: db.h:59
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define ARRAY_LEN(a)
Definition: utils.h:661

References ARRAY_LEN, ast_log, buf, jack_data::input_rb, jack_data::input_resample_factor, jack_data::input_resampler, LOG_ERROR, and LOG_WARNING.

Referenced by jack_process().

◆ handle_jack_audio()

static void handle_jack_audio ( struct ast_channel chan,
struct jack_data jack_data,
struct ast_frame out_frame 
)
static

handle jack audio

Parameters
[in]chanThe Asterisk channel to write the frames to if no output frame is provided.
[in]jack_dataThis is the jack_data struct that contains the input ringbuffer that audio will be read from.
[out]out_frameIf this argument is non-NULL, then assuming there is enough data avilable in the ringbuffer, the audio in this frame will get replaced with audio from the input buffer. If there is not enough data available to read at this time, then the frame data gets zeroed out.

Read data from the input ringbuffer, which is the properly resampled audio that was read from the jack input port. Write it to the channel in 20 ms frames, or fill up an output frame instead if one is provided.

Definition at line 619 of file app_jack.c.

621 {
622  short buf[jack_data->frame_datalen];
623  struct ast_frame f = {
625  .subclass.format = jack_data->audiohook_format,
626  .src = "JACK",
627  .data.ptr = buf,
628  .datalen = sizeof(buf),
629  .samples = ARRAY_LEN(buf),
630  };
631 
632  for (;;) {
633  size_t res, read_len;
634  char *read_buf;
635 
636  read_len = out_frame ? out_frame->datalen : sizeof(buf);
637  read_buf = out_frame ? out_frame->data.ptr : buf;
638 
639  res = jack_ringbuffer_read_space(jack_data->input_rb);
640 
641  if (res < read_len) {
642  /* Not enough data ready for another frame, move on ... */
643  if (out_frame) {
644  ast_debug(1, "Sending an empty frame for the JACK_HOOK\n");
645  memset(out_frame->data.ptr, 0, out_frame->datalen);
646  }
647  break;
648  }
649 
650  res = jack_ringbuffer_read(jack_data->input_rb, (char *) read_buf, read_len);
651 
652  if (res < read_len) {
653  ast_log(LOG_ERROR, "Error reading from ringbuffer, even though it said there was enough data\n");
654  break;
655  }
656 
657  if (out_frame) {
658  /* If an output frame was provided, then we just want to fill up the
659  * buffer in that frame and return. */
660  break;
661  }
662 
663  ast_write(chan, &f);
664  }
665 }
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
Definition: channel.c:5179
@ AST_FRAME_VOICE
#define ast_debug(level,...)
Log a DEBUG message.
Data structure associated with a single frame of data.
union ast_frame::@254 data
enum ast_frame_type frametype
struct ast_format * audiohook_format
Definition: app_jack.c:131
unsigned int frame_datalen
Definition: app_jack.c:133

References ARRAY_LEN, ast_debug, AST_FRAME_VOICE, ast_log, ast_write(), jack_data::audiohook_format, buf, ast_frame::data, ast_frame::datalen, jack_data::frame_datalen, ast_frame::frametype, jack_data::input_rb, LOG_ERROR, ast_frame::ptr, and ast_frame::samples.

Referenced by jack_exec(), and jack_hook_callback().

◆ handle_options()

static int handle_options ( struct jack_data jack_data,
const char *  __options_str 
)
static
Note
This must be done before calling init_jack_data().

Definition at line 707 of file app_jack.c.

708 {
709  struct ast_flags options = { 0, };
711  char *options_str;
712 
713  options_str = ast_strdupa(__options_str);
714 
716 
720  else {
721  ast_log(LOG_ERROR, "A server name must be provided with the s() option\n");
722  return -1;
723  }
724  }
725 
729  else {
730  ast_log(LOG_ERROR, "A client name must be provided with the c() option\n");
731  return -1;
732  }
733  }
734 
738  else {
739  ast_log(LOG_ERROR, "A name must be provided with the i() option\n");
740  return -1;
741  }
742  }
743 
747  else {
748  ast_log(LOG_ERROR, "A name must be provided with the o() option\n");
749  return -1;
750  }
751  }
752 
754 
755  return 0;
756 }
static const struct ast_app_option jack_exec_options[128]
Definition: app_jack.c:691
option_args
Definition: app_skel.c:141
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Definition: main/app.c:3126
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
Structure used to handle boolean flags.
Definition: utils.h:199
unsigned int no_start_server
Definition: app_jack.c:140
#define ast_test_flag(p, flag)
Definition: utils.h:63

References ast_app_parse_options(), ast_log, ast_strdupa, ast_string_field_set, ast_strlen_zero(), ast_test_flag, jack_exec_options, LOG_ERROR, jack_data::no_start_server, OPT_ARG_ARRAY_SIZE, OPT_ARG_CLIENT_NAME, OPT_ARG_INPUT_PORT, OPT_ARG_OUTPUT_PORT, OPT_ARG_SERVER_NAME, OPT_CLIENT_NAME, OPT_INPUT_PORT, OPT_NOSTART_SERVER, OPT_OUTPUT_PORT, OPT_SERVER_NAME, and options.

Referenced by enable_jack_hook(), and jack_exec().

◆ handle_output()

static void handle_output ( void *  buf,
jack_nframes_t  nframes,
struct jack_data jack_data 
)
static

Handle jack output port.

Read nframes number of samples from the ringbuffer and write it out to the output port buffer.

Definition at line 304 of file app_jack.c.

306 {
307  size_t res, len;
308 
309  len = nframes * sizeof(float);
310 
311  res = jack_ringbuffer_read(jack_data->output_rb, buf, len);
312 
313  if (len != res) {
314  ast_debug(2, "Wanted %d bytes to send to the output port, "
315  "but only got %d\n", (int) len, (int) res);
316  }
317 }
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

References ast_debug, buf, len(), and jack_data::output_rb.

Referenced by jack_process().

◆ init_jack_data()

static int init_jack_data ( struct ast_channel chan,
struct jack_data jack_data 
)
static

Definition at line 390 of file app_jack.c.

391 {
392  const char *client_name;
393  jack_status_t status = 0;
394  jack_options_t jack_options = JackNullOption;
395 
396  unsigned int channel_rate;
397 
398  unsigned int ringbuffer_size;
399 
400  /* Deducing audiohook sample rate from channel format
401  ATTENTION: Might be problematic, if channel has different sampling than used by audiohook!
402  */
406 
407  /* Guessing frame->datalen assuming a ptime of 20ms */
409 
411 
412  ast_debug(1, "Audiohook parameters: slin-format:%s, rate:%d, frame-len:%d, ringbuffer_size: %d\n",
414 
416  client_name = jack_data->client_name;
417  } else {
418  ast_channel_lock(chan);
419  client_name = ast_strdupa(ast_channel_name(chan));
420  ast_channel_unlock(chan);
421  }
422 
423  if (!(jack_data->output_rb = jack_ringbuffer_create(ringbuffer_size)))
424  return -1;
425 
426  if (!(jack_data->input_rb = jack_ringbuffer_create(ringbuffer_size)))
427  return -1;
428 
430  jack_options |= JackNoStartServer;
431 
433  jack_options |= JackServerName;
434  jack_data->client = jack_client_open(client_name, jack_options, &status,
436  } else {
437  jack_data->client = jack_client_open(client_name, jack_options, &status);
438  }
439 
440  if (status)
441  log_jack_status("Client Open Status", status);
442 
443  if (!jack_data->client)
444  return -1;
445 
446  jack_data->input_port = jack_port_register(jack_data->client, "input",
447  JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
448  if (!jack_data->input_port) {
449  ast_log(LOG_ERROR, "Failed to create input port for jack port\n");
450  return -1;
451  }
452 
453  jack_data->output_port = jack_port_register(jack_data->client, "output",
454  JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, 0);
455  if (!jack_data->output_port) {
456  ast_log(LOG_ERROR, "Failed to create output port for jack port\n");
457  return -1;
458  }
459 
460  if (jack_set_process_callback(jack_data->client, jack_process, jack_data)) {
461  ast_log(LOG_ERROR, "Failed to register process callback with jack client\n");
462  return -1;
463  }
464 
465  jack_on_shutdown(jack_data->client, jack_shutdown, jack_data);
466 
467  if (jack_activate(jack_data->client)) {
468  ast_log(LOG_ERROR, "Unable to activate jack client\n");
469  return -1;
470  }
471 
473  const char **ports;
474  int i;
475 
476  ports = jack_get_ports(jack_data->client, jack_data->connect_input_port,
477  NULL, JackPortIsInput);
478 
479  if (!ports) {
480  ast_log(LOG_ERROR, "No input port matching '%s' was found\n",
482  break;
483  }
484 
485  for (i = 0; ports[i]; i++) {
486  ast_debug(1, "Found port '%s' that matched specified input port '%s'\n",
487  ports[i], jack_data->connect_input_port);
488  }
489 
490  if (jack_connect(jack_data->client, jack_port_name(jack_data->output_port), ports[0])) {
491  ast_log(LOG_ERROR, "Failed to connect '%s' to '%s'\n", ports[0],
492  jack_port_name(jack_data->output_port));
493  } else {
494  ast_debug(1, "Connected '%s' to '%s'\n", ports[0],
495  jack_port_name(jack_data->output_port));
496  }
497 
498  jack_free(ports);
499 
500  break;
501  }
502 
504  const char **ports;
505  int i;
506 
507  ports = jack_get_ports(jack_data->client, jack_data->connect_output_port,
508  NULL, JackPortIsOutput);
509 
510  if (!ports) {
511  ast_log(LOG_ERROR, "No output port matching '%s' was found\n",
513  break;
514  }
515 
516  for (i = 0; ports[i]; i++) {
517  ast_debug(1, "Found port '%s' that matched specified output port '%s'\n",
518  ports[i], jack_data->connect_output_port);
519  }
520 
521  if (jack_connect(jack_data->client, ports[0], jack_port_name(jack_data->input_port))) {
522  ast_log(LOG_ERROR, "Failed to connect '%s' to '%s'\n", ports[0],
523  jack_port_name(jack_data->input_port));
524  } else {
525  ast_debug(1, "Connected '%s' to '%s'\n", ports[0],
526  jack_port_name(jack_data->input_port));
527  }
528 
529  jack_free(ports);
530 
531  break;
532  }
533 
534  return 0;
535 }
static int jack_process(jack_nframes_t nframes, void *arg)
Definition: app_jack.c:319
#define RINGBUFFER_FRAME_CAPACITY
Definition: app_jack.c:64
static void jack_shutdown(void *arg)
Definition: app_jack.c:336
static void log_jack_status(const char *prefix, jack_status_t status)
Definition: app_jack.c:174
jack_status_t status
Definition: app_jack.c:146
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
const char * ast_format_get_name(const struct ast_format *format)
Get the name associated with a format.
Definition: format.c:334
unsigned int ast_format_get_sample_rate(const struct ast_format *format)
Get the sample rate of a media format.
Definition: format.c:379
struct ast_format * ast_format_cache_get_slin_by_rate(unsigned int rate)
Retrieve the best signed linear format given a sample rate.
Definition: format_cache.c:512
const ast_string_field client_name
Definition: app_jack.c:125
const ast_string_field connect_input_port
Definition: app_jack.c:125
const ast_string_field connect_output_port
Definition: app_jack.c:125
const ast_string_field server_name
Definition: app_jack.c:125

References ast_channel_lock, ast_channel_name(), ast_channel_readformat(), ast_channel_unlock, ast_debug, ast_format_cache_get_slin_by_rate(), ast_format_get_name(), ast_format_get_sample_rate(), ast_log, ast_strdupa, ast_strlen_zero(), jack_data::audiohook_format, jack_data::audiohook_rate, jack_data::client, jack_data::client_name, jack_data::connect_input_port, jack_data::connect_output_port, jack_data::frame_datalen, jack_data::input_port, jack_data::input_rb, jack_process(), jack_shutdown(), LOG_ERROR, log_jack_status(), jack_data::no_start_server, NULL, jack_data::output_port, jack_data::output_rb, RINGBUFFER_FRAME_CAPACITY, jack_data::server_name, and status.

Referenced by enable_jack_hook(), and jack_exec().

◆ jack_data_alloc()

static struct jack_data* jack_data_alloc ( void  )
static

Definition at line 693 of file app_jack.c.

694 {
695  struct jack_data *jack_data;
696 
697  if (!(jack_data = ast_calloc_with_stringfields(1, struct jack_data, 32))) {
698  return NULL;
699  }
700 
701  return jack_data;
702 }
#define ast_calloc_with_stringfields(n, type, size)
Allocate a structure with embedded stringfields in a single allocation.
Definition: stringfields.h:432

References ast_calloc_with_stringfields, and NULL.

Referenced by enable_jack_hook(), and jack_exec().

◆ jack_exec()

static int jack_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 758 of file app_jack.c.

759 {
760  struct jack_data *jack_data;
761 
762  if (!(jack_data = jack_data_alloc()))
763  return -1;
764 
765  if (!ast_strlen_zero(data) && handle_options(jack_data, data)) {
767  return -1;
768  }
769 
770  if (init_jack_data(chan, jack_data)) {
772  return -1;
773  }
774 
777  return -1;
778  }
779 
782  return -1;
783  }
784 
785  while (!jack_data->stop) {
786  struct ast_frame *f;
787 
788  if (ast_waitfor(chan, -1) < 0) {
789  break;
790  }
791 
792  f = ast_read(chan);
793  if (!f) {
794  jack_data->stop = 1;
795  continue;
796  }
797 
798  switch (f->frametype) {
799  case AST_FRAME_CONTROL:
801  jack_data->stop = 1;
802  break;
803  case AST_FRAME_VOICE:
805  default:
806  break;
807  }
808 
809  ast_frfree(f);
810 
812  }
813 
815 
816  return 0;
817 }
static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f)
Definition: app_jack.c:537
static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_data, struct ast_frame *out_frame)
handle jack audio
Definition: app_jack.c:619
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3163
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4292
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
Definition: channel.c:5839
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
Definition: channel.c:5880
#define ast_frfree(fr)
@ AST_FRAME_CONTROL
@ AST_CONTROL_HANGUP
struct ast_frame_subclass subclass
unsigned int stop
Definition: app_jack.c:138

References AST_CONTROL_HANGUP, AST_FRAME_CONTROL, AST_FRAME_VOICE, ast_frfree, ast_read(), ast_set_read_format(), ast_set_write_format(), ast_strlen_zero(), ast_waitfor(), jack_data::audiohook_format, destroy_jack_data(), ast_frame::frametype, handle_jack_audio(), handle_options(), init_jack_data(), ast_frame_subclass::integer, jack_data_alloc(), NULL, queue_voice_frame(), jack_data::stop, and ast_frame::subclass.

Referenced by load_module().

◆ jack_hook_callback()

static int jack_hook_callback ( struct ast_audiohook audiohook,
struct ast_channel chan,
struct ast_frame frame,
enum ast_audiohook_direction  direction 
)
static

Definition at line 831 of file app_jack.c.

833 {
834  struct ast_datastore *datastore;
835  struct jack_data *jack_data;
836 
838  return 0;
839 
841  return 0;
842 
843  if (frame->frametype != AST_FRAME_VOICE)
844  return 0;
845 
846  ast_channel_lock(chan);
847 
848  if (!(datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
849  ast_log(LOG_ERROR, "JACK_HOOK datastore not found for '%s'\n", ast_channel_name(chan));
850  ast_channel_unlock(chan);
851  return -1;
852  }
853 
854  jack_data = datastore->data;
855 
857  ast_log(LOG_WARNING, "Expected frame in %s for the audiohook, but got format %s\n",
860  ast_channel_unlock(chan);
861  return 0;
862  }
863 
865 
866  handle_jack_audio(chan, jack_data, frame);
867 
868  ast_channel_unlock(chan);
869 
870  return 0;
871 }
@ AST_AUDIOHOOK_DIRECTION_READ
Definition: audiohook.h:49
@ AST_AUDIOHOOK_STATUS_DONE
Definition: audiohook.h:45
enum ast_format_cmp_res ast_format_cmp(const struct ast_format *format1, const struct ast_format *format2)
Compare two formats.
Definition: format.c:201
@ AST_FORMAT_CMP_NOT_EQUAL
Definition: format.h:38
direction
enum ast_audiohook_status status
Definition: audiohook.h:108
struct ast_format * format

References AST_AUDIOHOOK_DIRECTION_READ, AST_AUDIOHOOK_STATUS_DONE, ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_name(), AST_FRAME_VOICE, ast_log, jack_data::audiohook, jack_data::audiohook_format, ast_datastore::data, ast_frame_subclass::format, ast_frame::frametype, handle_jack_audio(), jack_hook_ds_info, LOG_ERROR, LOG_WARNING, NULL, queue_voice_frame(), ast_audiohook::status, and ast_frame::subclass.

Referenced by enable_jack_hook().

◆ jack_hook_ds_destroy()

static void jack_hook_ds_destroy ( void *  data)
static

Definition at line 819 of file app_jack.c.

820 {
821  struct jack_data *jack_data = data;
822 
824 }

References destroy_jack_data().

◆ jack_hook_write()

static int jack_hook_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 968 of file app_jack.c.

970 {
971  int res;
972 
973  if (!chan) {
974  ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
975  return -1;
976  }
977 
978  if (!strcasecmp(value, "on"))
979  res = enable_jack_hook(chan, data);
980  else if (!strcasecmp(value, "off"))
981  res = disable_jack_hook(chan);
982  else {
983  ast_log(LOG_ERROR, "'%s' is not a valid value for JACK_HOOK()\n", value);
984  res = -1;
985  }
986 
987  return res;
988 }
static int disable_jack_hook(struct ast_channel *chan)
Definition: app_jack.c:940
static int enable_jack_hook(struct ast_channel *chan, char *data)
Definition: app_jack.c:873
int value
Definition: syslog.c:37

◆ jack_process()

static int jack_process ( jack_nframes_t  nframes,
void *  arg 
)
static

Definition at line 319 of file app_jack.c.

320 {
321  struct jack_data *jack_data = arg;
322  void *input_port_buf, *output_port_buf;
323 
326 
327  input_port_buf = jack_port_get_buffer(jack_data->input_port, nframes);
328  handle_input(input_port_buf, nframes, jack_data);
329 
330  output_port_buf = jack_port_get_buffer(jack_data->output_port, nframes);
331  handle_output(output_port_buf, nframes, jack_data);
332 
333  return 0;
334 }
static void handle_output(void *buf, jack_nframes_t nframes, struct jack_data *jack_data)
Handle jack output port.
Definition: app_jack.c:304
static void handle_input(void *buf, jack_nframes_t nframes, struct jack_data *jack_data)
Handle jack input port.
Definition: app_jack.c:241
static int alloc_resampler(struct jack_data *jack_data, int input)
Definition: app_jack.c:193

References alloc_resampler(), handle_input(), handle_output(), jack_data::input_port, jack_data::input_resample_factor, and jack_data::output_port.

Referenced by init_jack_data().

◆ jack_shutdown()

static void jack_shutdown ( void *  arg)
static

Definition at line 336 of file app_jack.c.

337 {
338  struct jack_data *jack_data = arg;
339 
340  jack_data->stop = 1;
341 }

References jack_data::stop.

Referenced by init_jack_data().

◆ jack_status_to_str()

static const char* jack_status_to_str ( jack_status_t  status)
static

Definition at line 162 of file app_jack.c.

163 {
164  int i;
165 
166  for (i = 0; i < ARRAY_LEN(jack_status_table); i++) {
167  if (jack_status_table[i].status == status)
168  return jack_status_table[i].str;
169  }
170 
171  return "Unknown Error";
172 }
static const struct @25 jack_status_table[]

References ARRAY_LEN, jack_status_table, and status.

Referenced by log_jack_status().

◆ load_module()

static int load_module ( void  )
static

Definition at line 1036 of file app_jack.c.

1037 {
1039  return AST_MODULE_LOAD_DECLINE;
1040  }
1041 
1044  return AST_MODULE_LOAD_DECLINE;
1045  }
1046 
1047  return AST_MODULE_LOAD_SUCCESS;
1048 }
static struct ast_custom_function jack_hook_function
Definition: app_jack.c:990
static int jack_exec(struct ast_channel *chan, const char *data)
Definition: app_jack.c:758
static const char jack_app[]
Definition: app_jack.c:117
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:626
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1543

References ast_custom_function_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, ast_unregister_application(), jack_app, jack_exec(), and jack_hook_function.

◆ log_jack_status()

static void log_jack_status ( const char *  prefix,
jack_status_t  status 
)
static

Definition at line 174 of file app_jack.c.

175 {
176  struct ast_str *str = ast_str_alloca(512);
177  int i, first = 0;
178 
179  for (i = 0; i < (sizeof(status) * 8); i++) {
180  if (!(status & (1 << i)))
181  continue;
182 
183  if (!first) {
184  ast_str_set(&str, 0, "%s", jack_status_to_str((1 << i)));
185  first = 1;
186  } else
187  ast_str_append(&str, 0, ", %s", jack_status_to_str((1 << i)));
188  }
189 
190  ast_log(LOG_NOTICE, "%s: %s\n", prefix, ast_str_buffer(str));
191 }
const char * str
Definition: app_jack.c:147
static const char * jack_status_to_str(jack_status_t status)
Definition: app_jack.c:162
struct sla_ringing_trunk * first
Definition: app_meetme.c:1094
static char prefix[MAX_PREFIX]
Definition: http.c:144
#define LOG_NOTICE
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1117
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:739
#define ast_str_alloca(init_len)
Definition: strings.h:826
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Definition: strings.h:1091
Support for dynamic strings.
Definition: strings.h:604

References ast_log, ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_set(), first, jack_status_to_str(), LOG_NOTICE, prefix, status, and str.

Referenced by init_jack_data().

◆ queue_voice_frame()

static int queue_voice_frame ( struct jack_data jack_data,
struct ast_frame f 
)
static

Definition at line 537 of file app_jack.c.

538 {
539  float f_buf[f->samples * 8];
540  size_t f_buf_used = 0;
541  int i;
542  int16_t *s_buf = f->data.ptr;
543  size_t res;
544 
545  memset(f_buf, 0, sizeof(f_buf));
546 
549 
551  float in_buf[f->samples];
552  int total_in_buf_used = 0;
553  int total_out_buf_used = 0;
554 
555  memset(in_buf, 0, sizeof(in_buf));
556 
557  for (i = 0; i < f->samples; i++)
558  in_buf[i] = s_buf[i] * (1.0 / SHRT_MAX);
559 
560  while (total_in_buf_used < ARRAY_LEN(in_buf)) {
561  int in_buf_used;
562  int out_buf_used;
563 
564  out_buf_used = resample_process(jack_data->output_resampler,
566  &in_buf[total_in_buf_used], ARRAY_LEN(in_buf) - total_in_buf_used,
567  0, &in_buf_used,
568  &f_buf[total_out_buf_used], ARRAY_LEN(f_buf) - total_out_buf_used);
569 
570  if (out_buf_used < 0)
571  break;
572 
573  total_out_buf_used += out_buf_used;
574  total_in_buf_used += in_buf_used;
575 
576  if (total_out_buf_used == ARRAY_LEN(f_buf)) {
577  ast_log(LOG_ERROR, "Output buffer filled ... need to increase its size\n");
578  break;
579  }
580  }
581 
582  f_buf_used = total_out_buf_used;
583  if (f_buf_used > ARRAY_LEN(f_buf))
584  f_buf_used = ARRAY_LEN(f_buf);
585  } else {
586  /* No resampling needed */
587 
588  for (i = 0; i < f->samples; i++)
589  f_buf[i] = s_buf[i] * (1.0 / SHRT_MAX);
590 
591  f_buf_used = f->samples;
592  }
593 
594  res = jack_ringbuffer_write(jack_data->output_rb, (const char *) f_buf, f_buf_used * sizeof(float));
595  if (res != (f_buf_used * sizeof(float))) {
596  ast_log(LOG_WARNING, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
597  (int) (f_buf_used * sizeof(float)), (int) res);
598  }
599  return 0;
600 }

References alloc_resampler(), ARRAY_LEN, ast_log, ast_frame::data, LOG_ERROR, LOG_WARNING, jack_data::output_rb, jack_data::output_resample_factor, jack_data::output_resampler, ast_frame::ptr, and ast_frame::samples.

Referenced by jack_exec(), and jack_hook_callback().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 1026 of file app_jack.c.

1027 {
1028  int res;
1029 
1032 
1033  return res;
1034 }
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References ast_custom_function_unregister(), ast_unregister_application(), jack_app, and jack_hook_function.

Variable Documentation

◆ jack_app

const char jack_app[] = "JACK"
static

Definition at line 117 of file app_jack.c.

Referenced by load_module(), and unload_module().

◆ jack_exec_options

const struct ast_app_option jack_exec_options[128] = { [ 's' ] = { .flag = OPT_SERVER_NAME , .arg_index = OPT_ARG_SERVER_NAME + 1 }, [ 'i' ] = { .flag = OPT_INPUT_PORT , .arg_index = OPT_ARG_INPUT_PORT + 1 }, [ 'o' ] = { .flag = OPT_OUTPUT_PORT , .arg_index = OPT_ARG_OUTPUT_PORT + 1 }, [ 'n' ] = { .flag = OPT_NOSTART_SERVER }, [ 'c' ] = { .flag = OPT_CLIENT_NAME , .arg_index = OPT_ARG_CLIENT_NAME + 1 }, }
static

Definition at line 619 of file app_jack.c.

Referenced by handle_options().

◆ jack_hook_ds_info

const struct ast_datastore_info jack_hook_ds_info
static
Initial value:
= {
.type = "JACK_HOOK",
}
static void jack_hook_ds_destroy(void *data)
Definition: app_jack.c:819

Definition at line 819 of file app_jack.c.

Referenced by disable_jack_hook(), enable_jack_hook(), and jack_hook_callback().

◆ jack_hook_function

struct ast_custom_function jack_hook_function
static

Definition at line 968 of file app_jack.c.

Referenced by load_module(), and unload_module().

◆ 

const { ... } jack_status_table[]

Referenced by jack_status_to_str().

◆ status

jack_status_t status

Definition at line 146 of file app_jack.c.

Referenced by __bt_curdel(), __bt_delete(), __bt_get(), __bt_put(), __bt_seq(), __bt_sync(), __rec_close(), __rec_delete(), __rec_get(), __rec_iput(), __rec_put(), __rec_seq(), __rec_sync(), __rtp_recvfrom(), __rtp_sendto(), _child_handler(), _iax2_show_peers_one(), _sip_show_peer(), _sip_show_peers_one(), _stun_show_status(), acf_odbc_read(), acf_odbc_write(), action_extensionstate(), agi_exec_full(), analog_publish_dnd_state(), answer(), ast_audiohook_update_status(), ast_privacy_set(), ast_safe_system(), ast_sip_create_dialog_uas(), ast_sip_create_dialog_uas_locked(), ast_sip_format_contact_ami(), ast_sip_get_contact_short_status_label(), ast_sip_get_contact_status_label(), ast_sip_send_response(), ast_sip_session_terminate(), ast_srtp_change_source(), ast_srtp_create(), ast_system_publish_registry(), ast_unreal_hangup(), callerid_read(), callerid_write(), canary_exit(), chan_pjsip_incoming_response(), chan_pjsip_incoming_response_update_cause(), chanavail_exec(), change_favorite_icon(), channel_fax_cb(), channel_set_intercept_mode(), cli_contact_print_body(), complete_dpreply(), connectedline_read(), connectedline_write(), contact_apply_handler(), contact_remove_unreachable(), create_dialog_uas(), dbm_delete(), dbm_fetch(), dbm_firstkey(), dbm_nextkey(), diversion_incoming_response(), diversion_outgoing_response(), dundi_show_peers(), filestream_destructor(), format_ami_contactlist_handler(), get_buddy_status(), handle_cc_notify(), handle_cdr_pgsql_status(), handle_cli_iax2_show_peer(), handle_incoming_response(), handle_open_receive_channel_ack_message(), handle_outgoing_response(), hfp_send_clip(), hfp_send_cmer(), hsearch(), iax2_publish_registry(), identify_module(), init_jack_data(), jack_status_to_str(), join_queue(), load_pjsip(), log_jack_status(), mbl_status_exec(), meetme_stasis_cb(), member_status_available(), modlist_modentry(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), path_outgoing_response(), peer_status(), permanent_uri_handler(), process_log_list(), process_module_list(), publish_dial_end_event(), publish_dnd_state(), publish_load_message(), publish_load_message_type(), publish_unload_message(), qualify_contact_cb(), queue_exec(), read_exec(), readexten_exec(), rec_rdelete(), redirecting_read(), refresh_all_favorite(), registrar_add_unreachable(), registration_client_send(), reload_module(), remove_from_queue(), report_fax_status(), rfc3326_incoming_response(), rfc3326_outgoing_response(), ring_entry(), rtp_transport_wide_cc_feedback_status_append(), rtp_transport_wide_cc_feedback_status_vector_append(), safe_exec_wait(), sdp_search(), send_expansion_icon(), send_expansion_short(), send_favorite(), send_favorite_selected(), send_favorite_short(), send_icon(), send_manager_peer_status(), send_options_response(), send_response(), sendtext_exec(), session_inv_on_media_update(), session_on_rx_response(), setup_outbound_invite_auth(), shaun_of_the_dead(), show_entry_history(), sip_options_notify_endpoint_state_compositors(), sip_options_set_contact_status(), sip_options_update_endpoint_state_compositor_aor(), sip_publish_registry(), sip_publisher_service_queue(), sms_log(), system_create_resolver_and_set_nameservers(), system_registry_to_ami(), t38_reinvite_response_cb(), transfer_exec(), transport_create(), update_client_state_status(), update_status(), wait_for_answer(), wait_our_turn(), xfer_client_on_evsub_state(), xmpp_pak_presence(), xmpp_pak_s10n(), and xpidf_generate_body_content().

◆ str

const char* str

Definition at line 147 of file app_jack.c.

Referenced by acf_cut_exec(), active_channels_to_str(), add_hintdevice(), add_required_respheader(), add_user_extension(), analog_my_getsigstr(), anti_injection(), aoc_charge_type_str(), aoc_charged_item_str(), aoc_rate_type_str(), aoc_scale_str(), aoc_type_of_totaling_str(), aoc_volume_unit_str(), aocmessage_get_unit_entry(), append_event(), append_json(), append_json_single(), ast_ari_callback(), ast_ari_validate_date(), ast_ari_websocket_session_write(), ast_begins_with(), ast_category_get_templates(), ast_cc_agent_set_interfaces_chanvar(), ast_copy_string(), ast_ends_with(), ast_event_append_ie_str(), ast_format_generate_sdp_fmtp(), ast_func_read(), ast_func_read2(), ast_get_character_str(), ast_get_digit_str(), ast_get_money_en_dollars_str(), ast_get_money_str(), ast_get_phonetic_str(), ast_hashtab_hash_string(), ast_hashtab_hash_string_nocase(), ast_hashtab_hash_string_sax(), ast_include_rename(), ast_json_utf8_check(), ast_json_utf8_check_len(), ast_json_vstringf(), ast_parse_digest(), ast_say_character_str(), ast_say_digit_str(), ast_say_money_str(), ast_say_phonetic_str(), ast_set_cc_interfaces_chanvar(), ast_sip_global_default_outbound_endpoint(), ast_sip_pubsub_generate_body_content(), ast_sip_rdata_get_header_value(), ast_skip_blanks(), ast_sockaddr_parse(), ast_sockaddr_resolve(), ast_sockaddr_split_hostport(), ast_sockaddr_stringify_fmt(), ast_str_case_hash(), ast_str_expr(), ast_str_get_encoded_str(), ast_str_hash(), ast_str_hash_add(), ast_str_retrieve_variable(), ast_str_to_imax(), ast_str_to_int(), ast_str_to_long(), ast_str_to_lower(), ast_str_to_uint(), ast_str_to_ulong(), ast_str_to_umax(), ast_str_to_upper(), ast_str_to_uuid(), ast_tcptls_server_start(), ast_term_color_code(), AST_TEST_DEFINE(), ast_translate_path_to_str(), ast_trim_blanks(), ast_variable_list_join(), astman_append_json(), base64_helper(), build_cc_interfaces_chanvar(), build_nonce(), build_user_routes(), candidate_exten_advance(), cause_to_reason(), CB_ADD(), CB_ADD_LEN(), cc_extension_monitor_init(), cc_generic_agent_start_monitoring(), cc_unique_append(), celt_cmp(), check_event(), check_expr2_input(), check_mime(), cli_print_body(), collect_names_cb(), contacts_to_str(), count_linefeeds(), custom_log(), dbl_list_expect_reverse(), delayed_method2str(), dial_handle_playtones(), do_magic_pickup(), do_print(), dundi_ie_append_str(), ext_cmp_exten_strlen(), file_extension_from_string(), filter_leading_space_from_exprs(), filter_newlines(), find_realtime(), format_log_json(), format_str_append_auth(), function_fieldnum_helper(), function_fieldqty_helper(), g729_generate_sdp_fmtp(), sip_to_pjsip::get_bind(), get_content(), get_domain(), get_ipaddress(), h263_generate_sdp_fmtp(), h264_generate_sdp_fmtp(), handle_getvariablefull(), handle_playtones(), handle_show_translation_path(), handle_tcptls_connection(), hash_string(), iax_frame_subclass2str(), iax_ie_append_str(), iax_parse_ies(), ilbc_generate_sdp_fmtp(), import_helper(), init_appendbuf(), internalerror(), internaloutput(), is_really_num(), jack_str(), jingle_new(), json_utf8_check_full(), list_item_to_str(), LLB_ADD(), load_modules(), localnet_to_str(), localnet_to_vl_append(), log_jack_status(), mansession_cmp_fn(), match_to_str(), match_to_var_list_append(), mwi_subscription_mailboxes_str(), mwi_to_string(), my_getsigstr(), named_callgroups_to_str(), named_pickupgroups_to_str(), new_find_extension(), ParsingContext::next_stack(), opus_generate_sdp_fmtp(), parse_cdata(), pbx_retrieve_variable(), pjstr_hash(), pjstr_hash_add(), pl_append(), pp_each_extension_helper(), pp_each_user_helper(), process_text_line(), pvalWordSetString(), pvt_cause_cmp_fn(), SqlConfigParser::read(), read_mf_digits(), read_sf_digits(), readwavheader(), regex(), remove_spaces_before_equals(), replace(), res_sdp_crypto_parse_offer(), rtcp_payload_type2str(), say_character_str_full(), say_digit_str_full(), say_money_str_full(), say_phonetic_str_full(), security_event_stasis_cb(), sendtext_exec(), set2(), set_var_to_str(), silk_cmp(), sip_endpoint_identifier_str2type(), sip_endpoint_identifier_type2str(), sip_is_token(), sip_outbound_registration_status_str(), sip_subscription_to_ami(), siren14_generate_sdp_fmtp(), siren7_generate_sdp_fmtp(), smdi_ifaces_cmp_fn(), smdi_mwi_q_cmp_fn(), stasis_app_message_handler(), stasis_app_recording_if_exists_parse(), str2tech(), str_is_negative(), strbetween(), strreplace(), substitute_escapes(), tdd_generate(), test_2way_function(), test_core_format_generate_sdp_fmtp(), transmit_info_with_aoc(), transform::unicode(), ustmtext(), variable_count_cmp_fn(), vp8_generate_sdp_fmtp(), astconfigparser::write_dicts(), write_html_escaped(), and yyparse().