I can't hear any audio in my Asterisk application

You can only specify a directory, you can not specify a file. If you want to play only a single file for music on hold then create a directory to hold it, place the file in the directory, and provide the directory to the music class.

@jcolp, you are saying I should create a directory in moh directory, place the audio there and specify it like this

[moh-audio]
directory = /var/lib/asterisk/moh/mymusic/lighthouse

Am I correct?

Yes. That is how it works.

The audio did not play. Although it is an sln file, do you think thats is the reason.

Without logging or additional information I don’t know.

This is it

– Called SIP/30171942@gateway-default
– Started music on hold, class ‘default’, on channel 'SIP/24242424-00000197 '
– SIP/gateway-default-00000198 is ringing
– SIP/gateway-default-00000198 answered SIP/24242424-00000197
– Stopped music on hold on SIP/24242424-00000197

The musiconhold class should be [moh-audios] and not the [default] class

And what is the current configuration? Did audio flow when it was answered?

I don’t get what you mean by current configuration, I just heard the recipient say some stuff like a voicemail system and the call hung up.

Or should I remove the [default] configuration? And have only the [moh-audio], cos I have the [default] and the [moh-audio] there.

You have to specify when dialing what music on hold class to use, did you do this?

No, I didnt.

Do you mean in my dial statement

---- Dial(SIP/${number},10,m)

Yes. As well if the calling device is behind NAT then Asterisk may not be able to send media to it in that case, as Asterisk has to receive media in order to latch onto it. You can confirm by turning on “rtp set debug on” and seeing where Asterisk sends the music on hold.

Okay, so I should specify the moh class like this

---- Dial(SIP/${number},10,m(moh-audio))

[Aug 22 14:22:54] WARNING[18205][C-00005c3f]: res_musiconhold.c:884 _get_mohbyname: Music on Hold class ‘moh-audio’ not found in memory. Verify your configuration.
[Aug 22 14:22:54] WARNING[18205][C-00005c3f]: res_musiconhold.c:884 _get_mohbyname: Music on Hold class ‘moh-audio’ not found in memory. Verify your configuration.

When I specified like I did above, I got this warning message.

Then the music on hold class did not load or something else happened. Check the log and ensure you reloaded it. As well I’d suggest trying to debug and isolate these things yourself, as you’ll need to when using Asterisk and configuring things. If there’s specific questions then we’re here but you need to try to figure things out on your own.

Yes @jcolp, you are very right, I have to figure things out myself, but at times, I just get confused on why somethings do not just work even when I have taken the proper guidelines.

Like I said earlier, I am new to Asterisk, and I think the journey so far is worth it.

Please I posted a func_odbc writesql query earlier

[UPDATE]
prefix = CALLS
dsn = asterisk
writesql = INSERT INTO calls(date, user_id, source, destination, channel)
writesql += VALUES(‘2016-12-23:08:99:00’, ‘${VAL1}’, ‘${VAL2}’, ‘${VAL3}’, ‘${VAL4}’)

and my dialplan looks like this

exten => fastforward,1,NoOp(number= ${number})
same => n, set(ARRAY(__user_id,__destination,__gateway)=${DESTINATION_INFO(${number})})
same => n,set(CALLS_UPDATE(${user_id}, ${DidNumber}, ${destination}, ${gateway}))

But it not inserting records, also what is func_odbc now() equivalent like mysql now() to insert current datetime

Thanks