@@ -174,6 +174,12 @@ static int cwcid_careful_send(struct ast_channel *chan, unsigned char *buf, int
174
174
};
175
175
int amt ;
176
176
177
+ if (!len ) {
178
+ ast_log (LOG_WARNING , "Send buffer is empty, returning\n" );
179
+ return -1 ;
180
+ }
181
+ ast_debug (2 , "Carefully sending %d bytes\n" , len );
182
+
177
183
if (remain && * remain ) {
178
184
amt = len ;
179
185
@@ -210,7 +216,10 @@ static int cwcid_careful_send(struct ast_channel *chan, unsigned char *buf, int
210
216
211
217
/* Drop any frames that are not voice */
212
218
if (inf -> frametype != AST_FRAME_VOICE ) {
219
+ char frametype [32 ];
220
+ ast_frame_type2str (inf -> frametype , frametype , sizeof (frametype ));
213
221
ast_frfree (inf );
222
+ ast_debug (1 , "Skipping %s\n" , frametype );
214
223
continue ;
215
224
}
216
225
@@ -237,6 +246,7 @@ static int cwcid_careful_send(struct ast_channel *chan, unsigned char *buf, int
237
246
buf += amt ;
238
247
len -= amt ;
239
248
ast_frfree (inf );
249
+ ast_debug (2 , "%d bytes remaining\n" , len );
240
250
}
241
251
return 0 ;
242
252
}
@@ -288,21 +298,21 @@ static int cwcid_exec(struct ast_channel *chan, const char *data)
288
298
}
289
299
290
300
tz = args .timezone ;
291
- clidnum = ast_strlen_zero (args .number ) ? ast_channel_caller (chan )-> id .number .str : args .number ;
301
+ clidnum = ! ast_strlen_zero (args .number ) ? args . number : ast_channel_caller (chan )-> id .number .valid ? ast_channel_caller ( chan ) -> id .number . str : "" ;
292
302
if (strlen (clidnum ) > 15 ) {
293
303
ast_log (LOG_WARNING , "Caller ID number '%s' is greater than 15 characters and will be truncated\n" , clidnum );
294
304
} else if (ast_strlen_zero (clidnum )) {
295
305
ast_log (LOG_WARNING , "Caller ID number is empty\n" );
296
306
}
297
- ast_copy_string (clid , clidnum , 16 );
307
+ ast_copy_string (clid , clidnum , sizeof ( clid ) );
298
308
299
- clidname = ast_strlen_zero (args .name ) ? ast_channel_caller (chan )-> id .name .str : args .name ;
309
+ clidname = ! ast_strlen_zero (args .name ) ? args . name : ast_channel_caller (chan )-> id .name .valid ? ast_channel_caller ( chan ) -> id .name . str : "" ;
300
310
if (strlen (clidname ) > 15 ) {
301
311
ast_log (LOG_WARNING , "Caller ID name '%s' is greater than 15 characters and will be truncated\n" , clidname );
302
312
} else if (ast_strlen_zero (clidname )) {
303
313
ast_log (LOG_WARNING , "Caller ID name is empty\n" );
304
314
}
305
- ast_copy_string (cnam , clidname , 16 );
315
+ ast_copy_string (cnam , clidname , sizeof ( cnam ) );
306
316
307
317
if (!ast_strlen_zero (args .presentation )) {
308
318
presentation = ast_parse_caller_presentation (args .presentation );
0 commit comments