ok now how to set this audiocodes just to forward all call come from PSTN that connect on FXO port to asterisk and vice versa, forward all call from astersik to any available FXO port, this is the few step that will make audiocodes work with such configuration.
Configure audiocodes to have registration account with asterisk, this can be done easily with "Protocol Management -> Protocol Definition -> Proxy&Registration", fill on "Proxy IP Address", "Enable Registration : Yes", "Username", "Password", and "Authentication Mode : Per Endpoint".
Configuring "Protocol Management -> Endpoint Phone Number", this is important part for make each FXO port on audiocodes registered with asterisk, in here, under "Channel", you can fill with either 1, 1-2, 1-8, 3-4, or whatever you want to have, this means that port 1, or port 1-2, etc will registered on astersik with userid/username filled on "Phone Number", yes, that is correct, "Phone Number" on this configuration page is AlphaNumeric, the password is using global "Password" on First step.
next, on same page configure "Hunt Group ID", this is another important configuration which make audiocodes forward incoming call from asterisk to any available FXO. Hunt Group ID is number from 0 to any, I put 1.
to make audiocodes forward call from FXO to asterisk, configure "Endpoint Settings -> Automatic Dialing", I have 777 number on asterisk to handle all incoming call, so I put "Destination Phone Number" as 777 so every incoming call on FXO will be forwarded to 777 on my Astersik.
this is the last configuration that everyone need, forward call from asterisk to any available FXO. in "Routing Tables -> IP to Hunt Group Routing Table" configure under "Dest. Phone Prefix" with "*" (or any prefix that you might have), "Source Phone Prefix" with "*", "Source IP Address" with "*", "Hunt Group ID" with any number you configure on Step 2, in my case, 1.
thats it, all configurations are complete. the audiocodes now can forward the call from FXO to asterisk, and vice versa.
step 3 and step 4 basically the configuration that need to have if audiocodes reporting error such "[ERROR] #0:TrunkGroup::AllocateEndPoint- Can't find EndPoint for phone number"